Tharindu Thisarasinghe
Tharindu Thisarasinghe

Reputation: 3998

CSS .classname elementname

I have downloaded a WordPress theme and I'm doing some customization. In the style.css file there's a CSS class like this,

.entry-content h3 {
    font-size: 28px;
    font-size: 2.8rem;
}

So, I need to add this to my <h3> element. So, what's the way of doing it. How to add CSS class to the element..?

Upvotes: 1

Views: 127

Answers (2)

Bmd
Bmd

Reputation: 1318

On Wordpress if you go to the code entry view on any edit page, you can type in code rather than having the page automatically generate the code for you.

When you're in that code entry mode, you can type in any sort of "container" (like a div, an article, or a section, for example) and give it a class of entry-content (by including the text class="entry-content within the opening tag). Then all you have to do is put an h3 within that container and your CSS code will apply to it.

Example 1:

.entry-content h3 {color:blue;}
<article class="entry-content">
    <h3>Some Text</h3>
</article>

Example 2:

.entry-content h3 {color:red;}
<div class="entry-content">
    <h3>A heading</h3>
    <p>A paragraph</p>
    <h3>You can even have more than one H3</h3>
</div>

Upvotes: 3

Rodolfo
Rodolfo

Reputation: 1171

<span class="entry-content"><h3>Your text</h3></span>

Where span could be any tag with the attribute class setted to entry-content.

Upvotes: 1

Related Questions