Replacing Font and bold tags with CSS

admin

Administrator
Staff member
Hi everyone,

I am trying to make this this code


<p style="margin-top: 0"><font color="#FF0000">Job Title: </font><b>Idaho Jobs</b><font color="#FF0000"> </font>(F/T & P/T Opportunities)


look the same with CSS. My problem is that using DIVS or P or H1... tags make new lines. I need it to all be on the same line. I am sure this is simple but I am lost with it right now. Any ideas?

ScubaTry <span style="color:#ff0000; font-weight:bold;>Text here</span>
I don't know if that will work or not.I guess I was unclear. I am using an external style sheet and trying to replicate the former in-line css using an external style sheet. Thank you for the suggestion though.

Scubahave you tried adding "display: inline;" ?
they might be being treated as block elements..CSS

.someclass {
margin-top: 0;
}
.someclass span {
color: #f00;
}

HTML

<p class="someclass"><span>Job Title: </span><strong>Idaho Jobs</strong>(F/T & P/T Opportunities)</p>EDIT: GAH! Paul beat me to it :D But here's another way to skin this cat.

You don't necessarily need to create boldface text with CSS only. If you want text to be boldface, and surrounded by normal-weighted text, use the <strong> tag instead of the <b> tag. Making text boldface really means you want to give strong emphasis to those words, hence using the <strong> tag makes sense.

In your case:

/* Place this CSS in your external style sheet */
p.special {
color: #f00;
margin-top: 0;
}

p.special strong { color: #000; }

Then use the following HTML:

<p class="special">Job Title: <strong>Idaho Jobs (F/T & P/T Opportunities)</strong></p>Thank you,

That works great. Have a great day.

Scuba Steve
 
Back
Top