...

View Full Version : Text highlighting code



fairybusiness
02-24-2009, 02:26 AM
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.

Excavator
02-24-2009, 02:47 AM
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:

<!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>

fairybusiness
02-24-2009, 10:37 PM
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!!

Majoracle
02-24-2009, 10:52 PM
Do like Excavator showed, just wrap all the text in the span or p tag.


<style type="text/css">
.hlighted {
background: #fff;
}
</style>
and


<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


<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

Apostropartheid
02-24-2009, 10:52 PM
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.

harbingerOTV
02-24-2009, 11:03 PM
are you really talking about when you click and drag your cursor over text how the background turns one color and the text another?


::selection { background: #00B4E0; color: #10161D; /* Safari */ }
::-moz-selection { background: #00B4E0; color: #10161D; /* Firefox */ }

but IE won't understand.

Apostropartheid
02-24-2009, 11:05 PM
I think he's just talking about a background on text like this.

rfresh
02-25-2009, 01:31 AM
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.

Excavator
02-25-2009, 01:55 AM
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:
}
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.

fairybusiness
02-25-2009, 05:08 PM
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.

jerry62704
02-25-2009, 05:22 PM
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.

harbingerOTV
02-26-2009, 12:01 AM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum