Guest tenor1 Posted April 11, 2007 Share Posted April 11, 2007 I want to place background color behind certain words and phrases in the text of my website homepage. I want to make the text appear like I used a highlighter pen in either red or yellow to make words and phrases stand out on the page.I have gone through the HTML and XHTML tutorials. I cannot find any instructions on how to "highlight" lines of text, or sections of lines of text.Help will be greatly appreciated. Link to comment Share on other sites More sharing options...
vchris Posted April 11, 2007 Share Posted April 11, 2007 You'll need to use CSS. Here is an example:HTML:This <span class="yellowbg">word</span> is highlighted.CSS:.yellowbg { background-color: yellow; } Link to comment Share on other sites More sharing options...
Nim199 Posted April 12, 2007 Share Posted April 12, 2007 Or, if you only need one section of words highlited, use this:<p style="background-color: yellow">Hilighted Text</p> Link to comment Share on other sites More sharing options...
jlhaslip Posted April 13, 2007 Share Posted April 13, 2007 Fermat,That works if you use paragraphs for all the blocks of text on your page, but paragraphs aren't always the semantically correct tag to use. I would recommend the method vchris suggests. Spans are a generic inline container, which can also be a portion of a paragraph,and you avoid the necessity of dealing with the margins and paddings, etc of a paragraph. Furthermore, using a class will typically use less bandwidth for multiple occurrences of the "highlighted text" on a page. Link to comment Share on other sites More sharing options...
the_scyphe Posted April 15, 2007 Share Posted April 15, 2007 There are many ways to do it.For css:background-color:#fffFor html<body bgcolor="#fff">or<body style="background-color:#fff"> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now