Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Changing h3 tag with CSS

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #278381
    [email protected]
    Participant

    I want to make the h3 tag without a big space before and after. I had it working with the following inline css:

    <h3 style="margin-bottom: 0;margin-top: 0;line-height: 35px">Manuscript Editing Services</h3>

    But of course I want to add it to the external css file but when I do it doesn’t work. I added the following to the css file:

    .hmpg-h3 {
    margin-bottom: 0;
    margin-top: 0;
    line-height: 35px;
    }

    the html that goes with it is here:

    <h3 class="hmpg-h3">Manuscript Editing Services</h3>

    I have uploaded the new css file. Emptied my cache and tested it but it is not working. If I View Source” the HTML is changed to the new css so it is able to access the new css file fine. What simple thing am I missing?

    #278385
    Beverleyh
    Participant

    Maybe you need a higher specificity on the element selectors you’re using? Could be as simple as h3.hmpg-h3

    Check in the developer toolbar (F12) for anything else that could be overriding it with greater specificity, and then make yours more specific.

    #278400
    [email protected]
    Participant

    Wow! That worked! I don’t know why but it is working fine after I changed the entry from “hmpg-h3” to “h3.hmpg-h3”. I guess I don’t understand something basic like how this works.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.