February 18, 200818 yr I have read that search engines like h1 tags. The content I have doesn't suit any sort of title out there on its own. Id much prefer it if I could make it all look like one thing to the end user. IE <p>blah blah blah<h1>blah blah blah</h1></p>blah blah blah</p> Because the h1 tag is a block level tag this isn't coming out very good as to be expected but is there a way around this with CSS?
February 18, 200818 yr There is no logical reason at all to put an <h1> inside a <p>. That's about as un-semantic as you can get. You should use tags to best suit your content. If you don't have any headers, don't use any header tags. Just don't ever put a header inside a paragraph.
February 18, 200818 yr Author There is no logical reason at all to put an <h1> inside a <p>. That's about as un-semantic as you can get. You should use tags to best suit your content. If you don't have any headers, don't use any header tags. Just don't ever put a header inside a paragraph. I'm trying to optimise it for search engines, thats a logical reason. I hear search engines like h1 tags. don't get the prob? If this isnt the way its done that's fine but if i don't ask I dont learn. un-semantic????
February 18, 200818 yr Don't let search engines dictate how you write your markup. It's better to have a solid structure first, and using <p><h1>text</h1></p> might actually confuse a search engine. It would also confuse your readers. The 'text'... is it a heading or a paragraph? The two are mutually exclusive. If you don't have any headings, you shouldn't be using the <h1> tag, whether the search engines wants you to or not. The search engines like the <h1> tag because it tells them what the heading is. If you do still want to use the <h1> tag, you can customise its appearence with CSS. h1 { font-size:100%; font-weight:normal; } That'll make it look much more like your paragraphs.
February 18, 200818 yr It won't validate using the W3C Validator document type does not allow element "h1" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag. <p>normal p <h1>headline 1</h1> </p> ✉ The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element. One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").
February 18, 200818 yr Author h1 {font-size:100%; font-weight:normal; } Wouldn't that still give me the page break you get with a block level element? It would also confuse your readers. The 'text'... is it a heading or a paragraph? Rachel im not sure we have connected here. I wanted my header to look to readers like it wasn't a header and was a part of the paragraph. Readers wouldn't have had a clue either way. Not to worry though, this odiously isn't the way to go so I won't be doing it. If it won't validate as NeRo states its no good to me anyhow.
February 18, 200818 yr Rachel im not sure we have connected here. I wanted my header to look to readers like it wasn't a header and was a part of the paragraph. Readers wouldn't have had a clue either way. This is something that search engines (especially Google) frown upon. It wouldn't be the most blatant black hat technique, but the feeling is that nothing should be subversive on your page, e.g. a header should be a header, not part of your paragraph. Not saying this alone would get you banned, but you need to watch your step (also watch out for trying to place invisible H1 text somewhere that the background is the same colour as the text). H1 won't make or break your search engine results, so if you absolutely can't find a place for a heading then don't put one in. But it doesn't necessarily have to be in the document flow either - a good SEOer can find a place for H1 anywhere, and make it look natural too.
February 18, 200818 yr Author Thanks everyone good to know but if it wont validate im not wanting to do it.
February 18, 200818 yr Thanks everyone good to know but if it wont validate im not wanting to do it. Note that no one encouraged you to do it. You can style an <h1> any way you like. If you want it to be smaller than the rest of your text, you can even do that. Search engines don't really take much interest in your CSS. They're more fussed about your HTML.
February 18, 200818 yr Rachel im not sure we have connected here. I wanted my header to look to readers like it wasn't a header and was a part of the paragraph. Readers wouldn't have had a clue either way. People with vision impairments often use screen readers, and they are likely to get confused by "un-semantic" markup. Semantic just means that it makes sense... a good way to think about this is to turn your css off and see what the page looks like. If the page still makes sense then you probably have semantic markup. - Eris
December 18, 200916 yr Recently I've stucked with this problem too. I've found this solution: <p><span style="display: inline;"><h1 style="display: inline;>Title</h1></span></p> Works fine in Firefox and Opera, but doesn't work in IE8 (and other IE versions, I suppose). Replace p with div: <div><h1 style="display: inline;>Title</h1></div> You can even find tutorial if you Google for a while...
December 18, 200916 yr Lots of things are possible but not recommended. I think I would create a class for the p tags and h tag and give them all float: left; so that they sit side by side. The line-heights and top margins would probably need to be edited or vertical-align: middle used. <p class="heading">Text</p><h1 class="heading">Title</h1><p class="heading">More Text</p> h1.heading { float: left; line-height: 30px; margin: 0 3px; background: pink; } p.heading { float: left; line-height: 30px; margin: 0 3px; vertical-align: middle; background: lime; } Something like that, the vertical-align: middle for the p tag will align it with a larger h1 font size, as the h1 text will be out of line with the p text unless you correct it.
December 18, 200916 yr No, no, no, no... just no! A useful thread can of course be resurrected after almost a year if it's useful, but don't anyone seriously put a <h1> inside a <p> or make <h1> inline to use like bold for some kind of SEO scam. <h1> is your top-level header - use one and don't put it inline. End of!
December 19, 200916 yr Recently I've stucked with this problem too. I've found this solution: <p><span style="display: inline;"><h1 style="display: inline;>Title</h1></span></p> Works fine in Firefox and Opera, but doesn't work in IE8 (and other IE versions, I suppose). That code is about as invalid as it can get. You can NOT place a header tag inside a paragraph tag. Replace p with div: <div><h1 style="display: inline;>Title</h1></div> And what would be the point of putting the header tag in a div?
Create an account or sign in to comment