Home > Web Front-end > HTML Tutorial > css style not working??Isn't the priority of id selector higher than element selector? _html/css_WEB-ITnose

css style not working??Isn't the priority of id selector higher than element selector? _html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:57:08
Original
1434 people have browsed it

Please see the code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>无标题文档</title><style type="text/css">div{display:inline;width:100px;height:100px;padding:0;margin:0;float:left;}#div0{ width::400px;height:200px; background-color:black;display:block;float:none;}.div1{ background-color:red;}.div2{ background-color:blue;}.div3{ background-color:yellow;}</style></head><body><div id="div0">  <div class="div1"> 1</div>  <div class="div2"> 2</div>  <div class="div3"> 3</div></div></body></html>
Copy after login

Rendering:

According to the definition of css, div1, div2, and div3 should all be arranged horizontally, right? Why is the rendering effect vertical? Please give me some advice


Reply to the discussion (solution)

Halo! There is an extra colon after width! So the css doesn’t work
This is the disadvantage of Dreamweaver not having code checking. Using VS, you can immediately see the error

I also saw that the width of the #div0 style has an extra colon.

Okay, no one wants to pick up the points? If not, they will all be sent upstairs

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template