Forum Moderators: not2easy
I can get rid of the space above and below my h3, but even with all margins and padding at 0, it wastes the whole line to the right of the headline, which I can see by adding a border.
h3 {
display: inline;
}
Will do the trick ;) - H tags, as with p, div, table, and more are block level elements meaning (amongst other things) that you can't sit one beside the other without serious tampering. For example, you could float or absolutely position block elements so they sit side by side.
For this purpuse though, the most efficient method is to change it to an inline element like an img or strong or em tag.
Nick
for example, to get this:
<p>text text text <h*>text</h*> text text text</p>to display on a single line, like this:
text text text TEXT text text textyou must apply display: inline; to their element or class.
postscript: h* is substitute for any header tag that breaks up text, h1, h2, etc.
Here is another method using a <span> tag. Put this in your stylesheet or style tag:
.head1 {font-size:150%}
p {font-family:verdana}
Then your paragraph could be
<p>this is a very
<span class="head1">long line</span>
that is bound to break unless you have
a window that is at least a zillion
characters wide. You can change the style
of this paragraph with the class attribute.
</p>
When I used the same code except with the display:inline and anb h1 tag, the text following the </h1> was no longer verdana.
you can't <span> around <h1> that's the fault. the browser did right, because he corrected your malicious code on the fly.
not using <h1> etc. is a mess because these tags also structure the document.
I agree that using styles instead of formatting tags can be cumbersome, but it is part of what gives css an advantage in flexibility over straight html.
In the original post, aias1975 said, "I am trying to separate the styling from the content". That is what the <span> tag is for.
<p>Changing <span style="{color:red">color</span> is an example</p>
I have my suspicions about which way a few of you will swing, but I'm intrigued none the less.
(My apologies for going slightly off topic, but I didn't feel it warranted a new thread)
I tend to figure that if my structural markup is good, then CSS will get me where I want presentationally and where I "belong" in SERPs. This attitude is made more sustainable in my life than it might otherwise be by the fact that most of the sites I work on are non-commercial. I've got one forthcoming that will probably get to be my first true attempt at SEM.