Creating a CSS class to use in DIV to affect all contents of the DIV???

S

Some One

Hi!

I've created a CSS class that I use in a DIV tag. Is there a way that
I can write this class so it affects all the elements within the DIV?
I'm trying to affect the "text-decoration" of all the text elements
within the DIV (anchors, paragraphs, etc.)

What I have is pretty simple. The part sample below should produce
three lines of text on the browser, all links to various pages. The
first should be the default link colour, with no underline. The second
should be white text with an underline. The third and fourth should be
white text with no underline, indented 10 pixels. That isn't what
happens. They all follow the "a" (anchor) setting of "none" for the
decoration and the last two ignore the "color" setting to white. The
indent DOES work.

Obviously I'm doing something wrong. Can someone take a look and let
me know what my mistake is?

-------------------------------
<style>
a { text-decoration: 'none';}

.menu { color: '#ffffff';}

.level1 { margin-left: '0px'; text-decoration: 'underline';}

.level2 { margin-left: '10px'; text-decoration: 'none';}

</style>

....some code

<a href="home.html">Home</a><br>
<div class="menu level1"><a href="apage.html">A page</a><br></div>
<div class="menu level2"><a href="subpage1.html">Subpage
1</a><br></div>
<div class="menu level2"><a href="subpage2.html">Subpage
2</a><br></div>
 
T

Toby A Inkster

Some said:
I've created a CSS class that I use in a DIV tag. Is there a way that
I can write this class so it affects all the elements within the DIV?
I'm trying to affect the "text-decoration" of all the text elements
within the DIV (anchors, paragraphs, etc.)

Set text-decoration to 'foobar' for all elements contained within the
<div> with class 'blah':

div.blah * { text-decoration: foobar; }

Set only for specific elements:

div.blah p, div.blah li { text-decoration: foobar; }
 
S

Some One

Toby A Inkster said:
Set text-decoration to 'foobar' for all elements contained within the
<div> with class 'blah':

div.blah * { text-decoration: foobar; }

Set only for specific elements:

div.blah p, div.blah li { text-decoration: foobar; }

Thank you VERY much!

This was exactly what I needed to know. I knew it could be done, but
could not remember how (or think of what to Google).

Take care!
 
T

Toby A Inkster

Some said:
This was exactly what I needed to know. I knew it could be done, but
could not remember how (or think of what to Google).

For future reference, go to Google, enter "css selectors" and hit "I'm
Feeling Lucky" :)
 
A

andy johnson

For future reference, go to Google, enter "css selectors" and hit "I'm
Feeling Lucky" :)


Well, I'm feeling STUPIDD. I've been trying to learn CSS, with some
success actually, and run across the foobar thing occasionally, as in
the W3C site, which is what google took me to a la above... WHAT IS IT
in dumbshit?

TIA,

Andy

"There would be a lot more civility in this world if people
didn't take that as an invitation to walk all over you"
- (Calvin and Hobbes)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top