How do I stop a selector in css from affecting other in html | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How do I stop a selector in css from affecting other in html

I have formatted a link in the body using css and i didn't want the same thing with the footer but yet it keeps giving me the same thing

4th Jun 2018, 7:54 AM
Bil Amin
Bil Amin - avatar
9 Answers
+ 4
depends on ur requirement. to target only one link then use an id, to target a group of links then go with a class or go with grouping selectors.
19th Jun 2018, 10:41 AM
J.M. Muriithi
J.M. Muriithi - avatar
+ 2
use an id? or a class?
4th Jun 2018, 8:00 AM
Max
Max - avatar
+ 2
I'm a rookie, I don't think I know how to do that
4th Jun 2018, 8:01 AM
Bil Amin
Bil Amin - avatar
+ 2
use id and class for html elememt and utilize it properly with proper way definitely you dont have to faceany type of problem which u asked?
18th Jun 2018, 7:34 PM
Shivam Sandip Gokarankar
Shivam Sandip Gokarankar - avatar
+ 1
oh I get, Thanks Max
4th Jun 2018, 8:03 AM
Bil Amin
Bil Amin - avatar
+ 1
we USE these brackets in CSS { } YOU NEED TO CLOSE THE BRACKET TO STOP A SELECTOR FROM AFFECTING OTHER HTML ELEMENTS
16th Jun 2018, 4:18 PM
Divyanshi Jain
Divyanshi Jain - avatar
+ 1
an id attribute will definetly work
19th Jun 2018, 3:10 AM
Martha Mwangi
Martha Mwangi - avatar
0
add to you link the attribute class="myclass" and in your css use #myclass{...} instead of a{...}
4th Jun 2018, 8:02 AM
Max
Max - avatar
0
End curly bracket }
12th Jun 2019, 8:35 PM
Jian
Jian - avatar