vendredi 6 février 2015

Can you assign a css entry an html selector and a class selector?


Vote count:

0




If I have the following piece of CSS:



p {
color:red;
}


This will apply to all P html elements. Is there a way I can also assign a class based selector to that same css object? So I could then also have <h1 class="redText"> which would also use the css object above - as well as it applying to all <p> elements?



asked 5 mins ago


1 Answer



Vote count:

0




Yes. Use .redText,p to select everything with a class of "redText", and every "P" element.





.redText,
p {
color: red;
}



<h1 class="redText">Red Text!!!!!</h1>

<p>Red text!</p>

<h1>Normal text!!!</h1>




answered 45 secs ago






Can you assign a css entry an html selector and a class selector?

Aucun commentaire:

Enregistrer un commentaire