Help to modify CSS in WordPress – SitePoint

Could you help me find in this CSS file what I need to modify so that the underlined titles (h2, h3, etc.) have the correct line spacing for easy reading and so that the font size of the paragraph is like what it looks like now (currently, I have to add the HTML tag <p class="has-text-align-justify has-medium-font-size"> to make it look like this) by default? I also want to change the appearance of the links, which currently appear in red, to the traditional blue color.
I need these changes to be visible on both the desktop and mobile versions.

style.css (36.8 KB)
Often people use all sort of plugins with WP, which insert their own CSS in all sorts of places. I recently helped with a WP site using Elementor, and the number of locations CSS was stored was mind-boggling. You basically have to use the browser devtools to track down where each style is coming from and then work out where that style is stored within the godforsaken mess that’s euphemistically known as WordPress.
In principle, there is no plugin that adds CSS, as far as I know. The issue is that the theme’s design is not mine, and I don’t know where it might come from. It’s not built with any builder like Elementor or Divi; rather, it’s done directly with code. This makes me think that the mentioned adjustments should be in the CSS file attached earlier, although I cannot identify it. The blog post where the applied code is most clearly visible is this one: Nightshade Poisoning Data
There are at least four CSS files in there, and various ones set line heights for the text. All text seems to be set at 1.8 em in various sheets, but the one that is prevailing is this one.
I don’t see a specific line height set for headings. I guess the author didn’t think about what would happen if headings stretched over multiple lines.
You could perhaps go into any style sheet, or create a custom one (ah WordPress) and maybe set line height to something like this:
@ralphm It’s the challenge of working with code created by someone else; you’re unfamiliar with many of these aspects. So, are there 4 style sheets in the same sheet? Are they redundant? Would what you linked be the main one? As far as I know, the mobile version was done through CSS, correct? Would it change for both versions of the website?
The CSS example I provided would only affect the line spacing of the headers, leaving the other attributes unchanged. And what is a rem?
To make the change to the default paragraph text without having to inline it as in this post, what would I need to look for, the <p> tag in the CSS sheet?
So, are there 4 style sheets in the same sheet? Are they redundant?
As far as I can see, there are five separate style sheets, and more inline styles in the head of each page. They each probably have a lot in them, with various overlaps and duplications that fight it out with each other in the “cascade” (the C is CSS). Unfortunately, I don’t really know the answers to your questions. My suggestion would be to create your own custom style sheet in WP and set any style modifications there, such that they override any styles in those other style sheets. (That’s what I do when I help people with WordPress, which is thankfully very rare.)
Here’s a screen shot of the CSS files I see in the inspector:

The one that’s highlighted seems to be the one setting the line height for your text and headings (at least on desktop screens). I don’t think there’s any value in trying to modify those. Best to leave them alone.
@ralphm Upon seeing the less descriptive names of the CSS sheets, it occurred to me that they might have been created by the Litespeedcache cache plugin, which minifies, combines, etc., the CSS. That would explain why I can’t find them on my server, and they might be “confusing” the browser’s developer console. Is that possible?
You can access a version of the website before Litespeedcache applies any adjustments if you want to check: https://www.fotov60.com/2023/12/06/nightshade-envenenamiento-datos/?LSCWP_CTRL=before_optm
Ah, I see. Interesting. Looking at the pre-Lightspeed version does seem to show just one CSS file.
The line height is set at line 152:
But that’s really for all elements inside the .entry element. You can just set your desired line heights for your headings anywhere in that file. You just need to give them higher specifity than the rule copied above.
Then I must write something like this?
Sure. That will help for the H2 elements, but not the H3. You might find that spreads the lines too far apart, but just play with the setting to get it how you like it.
@ralphm I’ve made the changes, and finally, I added line-height: 1em;, which seems to provide good separation. What do you think about the current styles for h2, h3, h4, etc.? https://www.fotov60.com/?LSCWP_CTRL=before_optm Are they consistent, or would you change any parameters like font-size, font-weight, or any other for any of them to make their appearance correspond to their order of importance? I don’t know much about CSS, but it seems like this stylesheet is quite disorganized, with elements defined in various parts of it, isn’t it?
Looks okay to me. Certainly readable. I tend to like a bit more space between the lines, but as long as it’s readable, that’s really all that matters.
I don’t know much about CSS, but it seems like this stylesheet is quite disorganized, with elements defined in various parts of it, isn’t it?
That’s quite common as a stylesheet gets longer and longer. There are ways of writing CSS that are designed to make things less messy, but I’m not sure how much difference they really make.
Don’t you think that h3 and h2 are perhaps too similar, and it might be confusing which one is more important? Or is it just me paying too much attention? :joy:
They are different enough from each other. But I prefer each next heading to be smaller, just to make it obvious to the visual reader what the hierarchy is.
But I prefer each next heading to be smaller, just to make it obvious to the visual reader what the hierarchy is.
Can you recommend me what to change to make the hierarchy more obviously?
Your <h3> text is appearing bold (on my browser at least) because bold is a default for <h3> text. It is not being declared bold by CSS.
Edit:
to:
Your <h3> text is appearing bold (on my browser at least) because bold is a default for <h3> text.
Happens the same to h4,h5 or h6?
To modify the paragraph style how I can do it? Now in the last post I used <p class="has-text-align-justify has-medium-font-size"> to obtain something acceptable, because without it watches so small. I want to use orkney and serif fonts, an appropriate size to default text, and justified text if it is possible. What style lines I must write to achieve it?
Default headings are shown here:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements#examples
I am surprised the H5 and H6 fonts are so small.
Your CSS for <h1> to <h6> is in this file:
https://www.fotov60.com/wp-content/litespeed/css/5dcb158dce52540584d3bae115f63f3c.css?ver=bf25a
As the code has been minified, you can unminify it using https://unminify.com/ (or a similar website). You will then see that the CSS for <h1> to <h6> starts at line 171.
Instead of editing that code, you could append CSS to it which will overrule previous declarations of the same properties.
You can use the shorthand font property:
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
. . . and the CSS color property:
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
As far as I can see your webpage is not downloading the Orkney font.
Now you know why I would never use WordPress :grinning:.
Your CSS for <h1> to <h6> is in this file:
https://www.fotov60.com/wp-content/litespeed/css/5dcb158dce52540584d3bae115f63f3c.css?ver=bf25a
As the code has been minified, you can unminify it using https://unminify.com/ (or a similar website). You will then see that the CSS for <h1> to <h6> starts at line 171.
If you want see the CSS sheet before Litespeed cache optimize it you can se trough this url as I sayed in a post before
https://www.fotov60.com/?LSCWP_CTRL=before_optm
As far as I can see your webpage is not downloading the Orkney font
Is strange, almost h1, h2…et are declared with this fonts
Now you know why I would never use WordPress :grinning:.
I dont understand, dont use the same CSS rules as the others tools?
I want to obtain the cleanest CSS possible, thats why Im editing source CSS stylesheet. Later I must eliminate some things like references to lastfm or other things I never use because are outdated. Thats why I whant to make a rule to style text like this as I say in my previous post:
¿Alguna vez te has preguntado qué sucede con tus obras de arte cuando las subes a internet? Imagina que cada trazo, cada pixel, puede convertirse en una arma secreta contra aquellos que intentan apropiarse de tu creatividad sin tu permiso. Bueno, resulta que ahora hay una herramienta que permite a los artistas hacer precisamente eso. ¡Bienvenido a la era del envenenamiento de datos!
The Orkney font is available to download from a number of websites. It is a sans-serif font, nothing like the font that I see on my browser or as seen in your own screenshot in post #1.
As it is not a Google font, I would expect to see the font downloaded to site visitors’ browsers by @font-face:
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
Of course you would need to upload the font file to your server.
Powered by Discourse, best viewed with JavaScript enabled

source

Leave a Reply

Your email address will not be published. Required fields are marked *