Why does it work in one tag but not the other


#1

this is the fixed version of the problem .
the problem that i had before is when i put

<a href="https://facebook.com">Friend us on <span>Facebook!</span></a>

and then went to CSS to do this
span{

color:gray;
font-family:Verdana;}
text-decoration:none;

it didnt do anything .i expected that it would do at least something to the span text
but not until i removed "text-decoration:none; and put it in to the "a" tag in css did it work
can someone tell me why i encountered similar problems before but i have never understood why its like that


#2

css has the following the general syntax:

selector {
   property: value;
   property: value;
}
selector {
   property: value;
}

you always have to follow this syntax, without the css selector a, you would simply have invalid syntax


#3

so the a tag has control over span tag no matter what ? or is it bcs i didnt make a class for the span tag ,w8 come to think of it would it made any difference if the span tag had a class ?


#4

no

the a css selector will affect all anchor elements:

<a href="url">click me</a>

the span css selector will affect all span elements:

<span>span</span>

#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.