可能的重复:
XHTML中的所有有效自关闭标记是什么(由主要浏览器实现)?
(非空)自动关闭标签在HTML5中有效吗?
为什么浏览器认为这个<div />标签没有立即结束?
有人可以解释为什么会这样吗?
.lineBreak10
{
height: 10px;
}
Run Code Online (Sandbox Code Playgroud)
<div class="lineBreak10"/> - >不起作用
<div class="lineBreak10"></div> - >工作
我想创建一个页面,其中包含固定宽度/高度的div,当它们到达页面边缘时(从左到右).
首先,较小的div宽度/高度被忽略,因此它们是重叠的.
其次,div正在页面上而不是跨越.
http://jsfiddle.net/beakie/3S465/

任何人都可以告诉为什么(以及我需要做些什么来解决这个问题)?
谢谢
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Store Name</title>
<style>
.item-container {
width: 1200px;
height: 1200px;
background-color: blue;
}
.item {
display: inline-block;
width: 200px;
height: 200px;
background-color: red;
border: 1px solid black;
}
.image {
width: 100px;
height: 100px;
background-color: green;
}
.name {
background-color: purple;
}
.quantity {
background-color: orange;
}
</style>
</head>
<body>
<div>
Store Name
</div>
<div class="item-container">
<div class="item">
<div class="image" style="/*background-image: url('Artwork/1159.jpg');*/" />
<div class="name">Widget</div>
<div …Run Code Online (Sandbox Code Playgroud) 我在这里看不到什么?
HTML(index.html):
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="css/style.css"></link>
</head>
<body>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
CSS:(css/style.css)
body{
background-color:black;
}
Run Code Online (Sandbox Code Playgroud)
我已经仔细检查了文件结构.我错过了什么?
我在将多个参数传递给Javascript函数时遇到了一些麻烦.
功能:
function selectDino(dinosaurName, dinosaurHealth, dinosaurTraits)
{
localStorage.setItem("dinoName", dinosaurName);
localStorage.setItem("dinoHealth", dinosaurHealth);
localStorage.setItem("dinoTraits", dinosaurTraits);
location.replace("nextpage.html");
}
Run Code Online (Sandbox Code Playgroud)
....
调用(主要是"selectDino()"位):
<img class="leftDino" src="dino1.png" onmouseover = getDino("dinoOne") onclick=selectDino("dinoOne", "20", "Banterous")>
<img class="centerDino" src="dino2.png" onmouseover = getDino("dinoTwo") onclick=selectDino("dinoTwo", "18", "Spiky")>
<img class="rightDino" src="dino3.png" onmouseover = getDino("dinoThree") onclick=selectDino("dinoThree", "22", "Bitey")>
Run Code Online (Sandbox Code Playgroud)
每当我查看Chrome开发者控制台时,它都会告诉我以下内容:
Uncaught SyntaxError: Unexpected token }
Run Code Online (Sandbox Code Playgroud)
有人能帮忙吗?
编辑
在属性周围添加了单引号,这解决了问题.