weseodesign.com logo - Website Development, Search Engine Optimization & Search Engine Marketing

CSS Tricks - H tags styled for inline use

There are times when you may want to use a heading within a sentence and not have the line break after the heading code and have the heading look like regular bold text.

Here is the usual way this would look:

This is a heading running

into a sentence.

Here is the way the inline CSS styled sentence looks:

This a styled heading running

 into a sentence.

 

HTML Code:

<div><h1>This a styled heading running</h1>&nbsp;into a sentence.</div>

CSS Code:

body {
font-family: arial, helvetica, sans-serif;
font-size: .8em;
color: black;
}

h1 {
display:inline;
font-size: 100%;
font-weight: bold;
}

Notes:

  1. You have to insert the &nbsp; after the <h1> tag to insert the space.
  2. This can be used to style any H tag 1-6.
  3. Do not use all <h1> tags as your site might appear spammy to the search engines.  Use the tags the way they were intended, as headings for the various sections and sub-sections of your page.
  4. The actual page code of this example is slightly modified, so the example style tags do not overwrite the site's existing style rules.
  5. While this code will validate at the W3C, it might be considered, by some, as a bad design pratice, since it does not follow the true representation of the various sections.

 


 

Website Development Home

Website Resources

Free Directories

Paid Directories

SEO Tool Chest

About Us

Contact Us

Site Map

blog