Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-24-2009, 02:26 AM   PM User | #1
fairybusiness
New to the CF scene

 
Join Date: Feb 2009
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
fairybusiness is an unknown quantity at this point
Exclamation Text highlighting code

I want to be able to highlight my text, thats all. I would have thought it would be something like
font-hightlight: ffffff

but I cant figure it out. And when I do get something to work it just makes the whole background that color :S But i just want it to highlight the text, like you can do in micro soft. if anyone knows a simple html font code for that, that would be great.
fairybusiness is offline   Reply With Quote
Old 02-24-2009, 02:47 AM   PM User | #2
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
Hello fairybusiness,
Not sure there's any such thing as font-hightlight.

Does this work for you? The bits in red are what does it:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
html, body {
	font: 14px/14px "Comic Sans MS";
	background: #FC6;
	text-align: justify;
}
* {
	margin: 0;
	padding: 0;
	border: none;
}
#wrap {
	width: 800px;
	margin: 30px auto;
	background: #999;
	overflow: auto;
}
p {
	margin: 10px 20px;
}
.hlighted {
	background: #fff;
}
</style>
</head>
<body>
    <div id="wrap">
            <p>
                Lorem ipsum dolor sit amet, <span class="hlighted">consetetur sadipscing elitr,</span> sed diam nonumy eirmod tempor invidunt ut labore et dolore magna 
                aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no 
                sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam 
                nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo 
                duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
            </p>
    <!--end wrap--></div>
</body>
</html>
__________________
Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad
Excavator is offline   Reply With Quote
Old 02-24-2009, 10:37 PM   PM User | #3
fairybusiness
New to the CF scene

 
Join Date: Feb 2009
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
fairybusiness is an unknown quantity at this point
Thanks for the reply, but could you put the code into this form?

}
table, tr, td, li, p, div {
color:ffffff;
font-size:13pt;
font-family:Times New Roman;

}

That is what I have at the begining of my myspace layout code. I know this code <span style="background-color: COLOR">TEXT</span> but thats only to highlight certain parts, I want to highlight all of the text. If you know a code for this, please let me know!!
fairybusiness is offline   Reply With Quote
Old 02-24-2009, 10:52 PM   PM User | #4
Majoracle
Regular Coder

 
Join Date: Nov 2006
Posts: 246
Thanks: 13
Thanked 26 Times in 24 Posts
Majoracle is an unknown quantity at this point
Do like Excavator showed, just wrap all the text in the span or p tag.

Code:
<style type="text/css">
.hlighted {
	background: #fff;
}
</style>
and
Code:
<p>
                <span class="hlighted">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna 
                aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no 
                sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam 
                nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo 
                duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</span>
</p>
or

Code:
<p class="hlighted">
                Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna 
                aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no 
                sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam 
                nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo 
                duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</p>
This is probably the best that can be offered for a Myspace layout

Last edited by Majoracle; 02-24-2009 at 10:58 PM..
Majoracle is offline   Reply With Quote
Old 02-24-2009, 10:52 PM   PM User | #5
Apostropartheid
The Apostate


 
Apostropartheid's Avatar
 
Join Date: Oct 2007
Posts: 3,215
Thanks: 16
Thanked 265 Times in 263 Posts
Apostropartheid is on a distinguished road
I suspect this probably won't work as you want it. All of those are block-level elements, so it will be the background of the block instead of the text, as you said. You can always try making them display inline, but MySpace is in quirks mode, so the result is going to be unpredictable at best.
__________________
Blog | Twitter
Useful links: W3C HTML Validator | W3C CSS Validator | HTML 5 Guide
CF: HTML & CSS Resources/Tutorials Thread | HTML & CSS Posting Rules and Guidelines
Remember: no link, no code, no help!
Apostropartheid is offline   Reply With Quote
Old 02-24-2009, 11:03 PM   PM User | #6
harbingerOTV
Senior Coder

 
Join Date: Jan 2005
Location: Memphis, TN
Posts: 1,765
Thanks: 8
Thanked 123 Times in 121 Posts
harbingerOTV will become famous soon enough
are you really talking about when you click and drag your cursor over text how the background turns one color and the text another?

Code:
::selection { background: #00B4E0; color: #10161D; /* Safari */ }
::-moz-selection { background: #00B4E0; color: #10161D; /* Firefox */ }
but IE won't understand.
__________________
Stop making things so hard on yourself.
i is tugbucket :: help raise tugburg :: Whitehaven Kiwanis
harbingerOTV is offline   Reply With Quote
Old 02-24-2009, 11:05 PM   PM User | #7
Apostropartheid
The Apostate


 
Apostropartheid's Avatar
 
Join Date: Oct 2007
Posts: 3,215
Thanks: 16
Thanked 265 Times in 263 Posts
Apostropartheid is on a distinguished road
I think he's just talking about a background on text like this.
__________________
Blog | Twitter
Useful links: W3C HTML Validator | W3C CSS Validator | HTML 5 Guide
CF: HTML & CSS Resources/Tutorials Thread | HTML & CSS Posting Rules and Guidelines
Remember: no link, no code, no help!
Apostropartheid is offline   Reply With Quote
Old 02-25-2009, 01:31 AM   PM User | #8
rfresh
Regular Coder

 
Join Date: Jun 2007
Location: Los Angeles
Posts: 545
Thanks: 81
Thanked 5 Times in 5 Posts
rfresh is an unknown quantity at this point
I've done it by using <span class="highlight">highlighted text</span> in the actual text itself. Of course you'll need to define .highlight as a class. What I did was search for a word, say "Ship" and replace it with <span class="highlight">Ship</span> and that did the job. I did this using PHP so it was easy to search and replace the "Ship" text.
__________________
RalphF
Business Text Messaging Services
https://www.MobileTextingService.com
rfresh is offline   Reply With Quote
Old 02-25-2009, 01:55 AM   PM User | #9
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
I don't know tables and, from the tiny snippet you provide, it's hard to tell what your layout is like. It sounds like you just want a background color...
Try this:
Code:
}
table, tr, td, li, p, div { 
color:ffffff; 
font-size:13pt; 
font-family:Times New Roman;
background: #fff;
}
If that doesn't put it in the right place we may need to see the rest of your code.
__________________
Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

Last edited by Excavator; 02-25-2009 at 01:58 AM..
Excavator is offline   Reply With Quote
Old 02-25-2009, 05:08 PM   PM User | #10
fairybusiness
New to the CF scene

 
Join Date: Feb 2009
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
fairybusiness is an unknown quantity at this point
Well, I am putting this into a myspace code, so I'm not sure you want to see the rest of my myspace code. But I am making layouts for other people, so that is why I cant apply the background color code to their paragraphs b/c I dont know where and what they will be. That is why I need to have all of the codes inside of the myspace layout code, so that all they have to do is paste it into there myspace and write.

table, tr, td, li, p, div {
color:ffffff;
font-size:13pt;
font-family:Times New Roman;
}

That is just the only area that affects the regular inputted text. I tried text-highlight: but that didnt work. And the thing is, is that its a table, not a class, so if i just put background-color: it affects the whole table, and does not highlight.
fairybusiness is offline   Reply With Quote
Old 02-25-2009, 05:22 PM   PM User | #11
jerry62704
Senior Coder

 
jerry62704's Avatar
 
Join Date: Oct 2007
Location: Springfield, IL
Posts: 1,049
Thanks: 9
Thanked 82 Times in 82 Posts
jerry62704 is on a distinguished road
Note several posts have shown:

color: #ffffff;

Also the correct font family is:
font-family: "Times New Roman";

When a font has spaces in the name, it has to be enclosed in quotes.
__________________
.
.
...and gladly would he learn and gladly teach

Visit www.LiberalsWin.com for humor and the unique Bush/Obama Approval Polls
jerry62704 is offline   Reply With Quote
Old 02-26-2009, 12:01 AM   PM User | #12
harbingerOTV
Senior Coder

 
Join Date: Jan 2005
Location: Memphis, TN
Posts: 1,765
Thanks: 8
Thanked 123 Times in 121 Posts
harbingerOTV will become famous soon enough
actually Jerry, myspace eats #'s for lunch. so color: fff is actually correct in this case *le sigh

fairybusiness,

make a myspace account and try what you tried and then post a link. it will help all of us try to understand exactly what you want and you'll get better answers.
__________________
Stop making things so hard on yourself.
i is tugbucket :: help raise tugburg :: Whitehaven Kiwanis
harbingerOTV is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:40 PM.


Advertisement
Log in to turn off these ads.