PDA

View Full Version : Help on some centering, coloring, underlining


Davimert
4th June 06, 10:47 AM
With the following sentence:
I love cookies. They rule!

How can I make the text centered?
How can I make They rule! red text and still keep everything centered in the text.
How can I Underline cookies and still keep everything centered and They rule! in red?
How can I make I love green and still keep cookies underlined, everything centered and
They rule! in red?

I'm pretty new to CSS/XHTML and this will help me a lot, thanks people :D

:)

Andy
4th June 06, 10:53 AM
HTML:

<span class="style1"><span class="style3">I love</span> <u>cookies</u>. <span class="style2">They rule!</span></span>


CSS:

.style1 {
text-align: center;
}

.style2 {
color: #CC1100;
}

.style3 {
color: #DFFFA5;
}

Davimert
4th June 06, 11:02 AM
:D Thanks, is the first one HTML, or XHTML?
I need XHTML

Jen
5th June 06, 05:58 AM
The first one is still xhtml. Span is the text style. <div> as xhtml is the box style.

To center all your texts:

CSS
style1...& the rest...

.center {
text-align: center;
}

XHTML
<div class="center">

<span class="style1...& the rest...

</div>

Davimert
5th June 06, 09:28 AM
New problem, I'm not allowed to use the <u> tag :(

Jen
5th June 06, 09:54 AM
Can you clarify what you mean not allowed to use the <u> tag?

'cookies' text does showing underline

Nemus
5th June 06, 11:00 AM
Yeah, the <u>-tag is dropped in XHTML 1.1 Strict, right?

just replace <u>cookies</u> with <em class="underline">cookies</em>

and add the following to the css:

em.underline {
text-decoration: underline;
font-style: none;
}


Hope that'll help ya!

Davimert
7th June 06, 05:11 PM
Weeeeeeeeee, thank you :D this can be closed now

marks
8th June 06, 12:12 AM
Welcome to the forums, by the way... Davimert: Do you totally understand what has happened above or just trying to get this mini project done?

If you have any questions, people here are more than willing to explain if you listen and are willing to learn.

Good luck :)