Cannot bind CSS to HTML.

<!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="http://stena38.ru/adm/css/css.css"> </head> <body> <div id="block1"> <div id="menu"> <div id="new_z"> Новые заказы </div> <div id="obr_z"> Заказы в обработке </div> <div id="old_z"> Обработанные заказы </div> <div id="dobtov"> Добавить товар </div> </div> </div> </body> </html> 

This is an index.

  .menu { background:red; padding:5px; } 

This is a CSS file. The point before the menu was removed, it was experimented with quotes. Under the link all opens. If you put it directly into a file, then everything works. A reference to any. What could it be?

  • in the markup you have id, and in css you are trying to refer to the class. Change point to # and it will work - Grundy
  • Thank. All day fought over this nonsense. But then why if you make one file, then everything works? - Ivan Ivanov
  • What does it mean if done in one file ? Not seeing exactly how you tried it - you can't say anything, maybe you just tried it with # - Grundy

1 answer 1

This will work if css and html are in the same folder.

 <link rel="stylesheet" type="text/css" href="theme.css"> 

If they are in different folders, then you need to specify the path from the html file to css

To bind the style to the style identifier of the element, use the symbol "#"

For example:

 css: #idname{...} html: <div id="idname">...</div> 
  • the author is not the problem. It downloads the absolute path file. - Grundy
  • @Grundy I already understood .. the author a minute after my answer added html to the question)) - ogorank
  • Not added, but just formatted corrected. - Grundy
  • However, the questions are not added to the link on the css and css is not used different. the answer was given to the first one, it could not be minus .. - ogorank
  • could if the answer answered the question. But this answer is not at all related to the question. - Grundy