Mobile app version of vmapp.org
Login or Join
Yeniel278

: .class selector syntax Is NOT valid.. What is the new valid form for CSS .class selectors? So... I'm a newbie in CSS and just a moment a go I discovered something wierd! This is the code

@Yeniel278

Posted in: #Css #Html

So... I'm a newbie in CSS and just a moment a go I discovered something wierd!
This is the code i wrote...

li.list { float: left; } ... but it did not work. If I am being to unclear let me explain.. tag.class_name is the official syntax for this type of situation! My command says that I want to change the element li that is a part of the class list so that it floats to the left of the page "viewport".

And when I changed the command to .list li { float: left; } it worked..

So my question is this.. Is this ( What I am experiencing ) somekind of a new update to css that I don't know about even tho I have been looking for answer elsewere.. or is it just for me???!

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Yeniel278

1 Comments

Sorted by latest first Latest Oldest Best

 

@Frith110

I highly suggest looking up the entry on CSS selectors on MDN and looking up a reference chart such as the one on W3 Schools. These haven't changed much since the first iteration of CSS.

By taking the example you've quoted here,


li.list selects all <li> elements with class="list" (.class selector)
.list li selects all <li> elements that are children of any element with a class="list" (element element selector)

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme