像这样?
<li>Menu1</li><div></div>
<li>Menu2</li><div></div>
我这样做的原因是使用 CSS 为 div 设置样式,以制作带有渐变的分隔符。
Nope. You can check for yourself here: http://validator.w3.org/
You might be able to get a similar result using the CSS pseudo-element ::after
, depending on how you're styling your <li>
s.
E.g.
li {
list-style: none;
margin: 0;
padding: 0;
display: inline-block;
}
li::after {
display: inline-block;
content: "";
width: 10px;
height: 10px;
background: #000;
}
Apply gradient backgrounds as desired.
Note that to support IE8, you'll need to use the older syntax :after
instead, and IE 7 doesn't support this pseudo-element at all.
不,此 HTML 结构无效。
参考: http ://www.w3.org/TR/html-markup/ul.html#ul-content-model
你最好这样使用,
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<ul>
<li>Menu1</li>
<li><div></div></li>
<li>Menu2</li>
<div></div>
</ul>
</body>
不!检查它:http: //validator.w3.org/
编辑验证此代码以查看它是否无效:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<ul>
<li>Menu1</li>
<div></div>
<li>Menu2</li>
<div></div>
</ul>
</body>
</html>