• Author
  • #44151


    Hi There,

    I am trying to edit the line-height in the body of my blog entry but not the line height in my customized sidebar widgets. I was trying something like this



    the problem is that the sidebar widget is defaulting to the paragraph line-height. any ideas? i ahve tried a !important tag but have no idea how to insert it or where and if it is to be used in combination with another selector or on its own.



    Just a clarification, “!important” is a declaration, not a tag.

    An “!important” declaration is put together with the value of your property. Example:

    p{line-height: 10pt !important;}

    Notice that I’m using points instead of pixels (px) as units. It’s of good practice, when dealing with text, to always use ‘pt’ or ’em’ to define their size. Only use pixels (px) as units when you want to manipulate margins, paddings, heights, widths, etc. of elements other than text.

    Now, you have to see if the line-height of the element you want to define is nested in another element. For instance, if you want to affect all the <p> tags inside the <li> tags, then you’d have to do something like this in order to affect such element:

    ul li p{line-height: 10pt;}

    Noticed that I didn’t use the “!important” declaration because I’m being more ‘specific’ in my element definition.

    If that doesn’t work (which it should), then you’d want to add the “!important” declaration.

    You’d want to check also if the element you want to affect (I’m assuming is the <p> tag) has a CSS class, for example:

    <p class="cssClass">text</p>

    If it does, then you’d need to add the line-height property to the cssClass class.

    Hope this helps.



    I’m not able to pull up your blog from here but wouldn’t you have to declair it as part of your body div as well?

The topic ‘CSS QUESTION’ is closed to new replies.