How to use the id selector | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

How to use the id selector

I put it in a example.css and then on my html I try it. it did not work but the class selector work. ps. I seperate my content and style

14th Mar 2017, 10:49 AM
Renz Jake Castro
Renz Jake Castro - avatar
4 Réponses
0
<div id="divOne"> </div> /****example.css **/ #divOne{ color: #FFFFFF; background-color:000000; }
14th Mar 2017, 12:09 PM
Devish
Devish - avatar
0
yes I already try it. html <div id="sample"> <p> test para </p> <p> test paragraph </p> </div> and the css file #sample {color: blue; background-color: gray;} and it wont work
14th Mar 2017, 12:15 PM
Renz Jake Castro
Renz Jake Castro - avatar
0
do you linked the example.css on header of your page
14th Mar 2017, 12:35 PM
Devish
Devish - avatar
0
yes. <link rel="sheetstyle" href="example.css"> and it work on class and now I try the id selector again and it work like class. it should be <p id="sample"> so it just like a class selector
14th Mar 2017, 12:39 PM
Renz Jake Castro
Renz Jake Castro - avatar