I’m a self-taught novice seeking guidance from experts here. I need help with defining CSS in WordPress to change the font size, color and weight of header on a website page.
So far, the code I have is:
<h2><strong><a style="color: #3f51b5">Text for the header I need to be 30 pixels large and in bold. The size here is still too small. </strong></h2>
How do I change it so the font is 30 pixels large and bolder?
Apologies if this was asked and answered before, but all my search results here did not specifically address my issue. I thank you in advance for your help. This is my first question to this group.
I would do it as follows:
.fs30 {
font-size: 30px;
font-weight: bold;
}
<h2><strong><a class="fs30" style="color: #3f51b5">Text for the header I need to be 30 pixels large and in bold. The size here is still too small. </strong></h2>
If the style is not applied, then you have one of the following problems:
fs30
All these problem types are well-documented.
EDIT: You needed the following rule:
font-size: 30px; font-weight: bold;
You can add the rule in several possible ways:style="font-size: 30px; font-weight: bold;"
inside the tag header.fs30 {font-size: 30px; font-weight: bold;}
inside a<style>
tag.fs30 {font-size: 30px; font-weight: bold;}
inside an external CSS fileFor approaches 2. and 3. you will need to add the
class="fs30"
attribute to the target tag(s). Approach 1. is clearly inferior to approach 2. and 3., due to the following facts:style
attribute is not reusable, if you want to reuse it for another tag, you will have to copy it. If you have already copied it 200 times and you want to change the design, you will have to change it for all the 200 casesstyle
attributes are structurally irrelevant, their purpose is solely design-related and unneededly makes your code messySo, instead of a
style
attribute, you clearly need astyle
tag or an external css file. However, external css files are superior compared tostyle
tags. Your html code will be smaller this way, also, very important is that the css file will be cached by some browsers, reducing the size of data needed to be downloaded on further extractions, therefore your users will experience bigger speed, while your server will be more scalable. Not to mention the fact that external css files are more reusable thanstyle
tags, so you will duplicate only your link tag (1 line of code) instead of thousands of lines if needed.