Forum Moderators: not2easy
Hoping someone here can help! I'm trying to get whatever I have within my heading tags to stay on the same line.
My code..
Welcome to <h1 class="h1_welcome">Widgets</h1>!
.h1_welcome {
FONT-SIZE: 12px;
COLOR: #000000;
}
I'm trying to get this all on the same line:
Welcome to Widgets
But instead I get:
Welcome to
Widgets
!
Any ideas? It's probably something really simple. Hope this post makes sense, It's been a long day!
PH
Welcome to <h1 class="h1_welcome">Widgets</h1>!
The trouble is that you're using a block element as an inline one, with unknown consequences. An
h1 cannot be part of a paragraph. That leaves any text after the </h1> outside of a containing block. You should put your resulting page through the HTML validator [validator.w3.org] to see how many errors this causes.
surely it would be better (with seo in mind) just to have my "Widgets" keyword within my h1 tags rather than "'Welcome to' Widgets"
Supposedly, there is an SEO benefit to having your keyword in your h1 tag. I'm unsure whether that benefit is diluted by the presence of non-keyword text. I would not think that the difference, if any, would be that much.
SEO benefit or not, your usage, as encyclo has pointed out, is the wrong usage, and is certain to continue giving you problems so long as you have a block level <h1> tag nested in a <p>aragraph, which according to specs [w3.org] can contain only inline elements.
cEM