SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Pandora Tipem's Avatar
    Join Date
    Feb 2006
    Posts
    450
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    <h1> always 100%? how to fix?

    Hi,

    I have an <h1> tag in a div (#left to be exact) and I'm applying the "background" attribute to it. However, this background spans 100&#37; of the div that it's in, when I really just want the background ONLY to wrap around the text, not 100%! How can I fix this?

    Demonstration...



    I hope my question is clear. Let me know if you have any questions to further clarify myself.

    Thanks in advanced!
    Tipem no fancy sig, yup
    Need Neopets Help? Try Neopets
    fun adoptable eggs

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,355
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    Static element always expand to fill the width of the parents so effectively they will always stretch to 100&#37; of the available width.

    If you float the element without a width then it will shrink wrap its content.

    You will then just remember to make sure that the very next element has clear:both applied so that it starts on a new line and doesn't wrap the float.

    Of course once its floated you won't be able to easily center it.

  3. #3
    Pandora Tipem's Avatar
    Join Date
    Feb 2006
    Posts
    450
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, that did the trick.
    Tipem no fancy sig, yup
    Need Neopets Help? Try Neopets
    fun adoptable eggs


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •