I want to put the background property on the slider type in the css, it contains the logo and menu, and if it's just a header. I inserted all the divs into the div slider, set the dimensions for it to 200x200 but it doesn't work for me, what could be the problem?

<!DOCTYPE html> <html> <head> <link href="main.css" rel="stylesheet"> </style> </head> <body> <div class="slider"> <div class="header"> <div class="logo"> <img class="logo" src="images/logo.jpg"> </div> <div class="menu"> Home About Us Portfolio Features Blog Pricing Shortcodes Contact </div> <div class="card-header"> <img src="images/header-card.jpg"> </div> <div class="search-header"> <img src="images/icon-search.jpg"> </div> </div> </div> </body> </html> 

sss file:

 .header{ display:inline-block; } .slider{ background-image: url('images/slider-bg.jpg');; width: 200px; height: 200px; } 
  • what does not work? from the question is not clear. If the picture is not shown, then you need to check the path. you may need to specify it like this: background-image: url('../images/slider-bg.jpg') - lexxl
  • The problem is in the path to the image, either in the properties of the higher priority rule for the specified block, or in that your background is completely covered by internal elements. According to your description of the problem, one can guess forever - alenkins

2 answers 2

If the error is in; It does not count, then look at the image path, if it is located in the adjacent folder, then the background-image: url('../images/slider-bg.jpg'); path is background-image: url('../images/slider-bg.jpg'); otherwise, the error is only in writing an extra sign or the absence of an image.

    extra semicolon in background image