Results 1 to 3 of 3
Thread: <h1> always 100%? how to fix?
Feb 26, 2008, 16:08 #1
<h1> always 100%? how to fix?
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% 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?
I hope my question is clear. Let me know if you have any questions to further clarify myself.
Thanks in advanced!
Feb 26, 2008, 16:33 #2
- Join Date
- Jan 2003
- Hampshire UK
- 183 Post(s)
- 6 Thread(s)
Static element always expand to fill the width of the parents so effectively they will always stretch to 100% 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.
Feb 26, 2008, 16:58 #3