Need a 10x10 square with color fill. It seems to be doing everything right, but it is not displayed.

.top ul li:before { content: ""; background: #1b1b40; height: 10px; width: 10px; } 

Closed due to the fact that the essence of the question is not clear to the participants by Denis , user194374, Bald , cheops , kmv 29 Jul '16 at 7:42 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • add layout to the question - Vasily Barbashev
  • I added a piece of code. - Alexander
  • Can we know how you build a DOM model? Always write everything that something in your code points to. Faster and easier to understand - Vasily Barbashev

1 answer 1

You need to add display: block; or display: inline-block;

 .top ul li:before { content: ""; background: #1b1b40; height: 10px; width: 10px; display: inline-block; } 
 <div class="top"> <ul> <li></li> </ul> </div> 

  • That's what I missed, thanks! - Alexander
  • @ Alexander, the answer can be taken by pressing the check mark on the left above - lexxl