在学html和css,写了很简单的,代码如下
html代码
<!DOCTYPE html>
yes,it is a div example for test11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
css代码
#02{
border: solid;
border-width: 2px;
border-color: cornflowerblue;
width: 200px;
height: auto;
text-align: center;
}
测试时候文本一点改变也没有,求问大神这是怎么回事
css id选择器不能数字开头,而且你id也没有。。外部css注意检查路径对了没有
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
#d02{
border: solid;
border-width: 2px;
border-color: cornflowerblue;
width: 200px;
height: auto;
text-align: center;
}
</style>
<title>02</title>
</head>
<body>
<div id="d02">
<h1>it's a div temp</h1>
<p>yes,it is a div example for test11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111</p>
</div>
</body>
</html>
给div加上 id=02
id改为d02之后调试的结果。。。。
这个1111111为什么突破边际了。。。。。
div如果在不设宽度的时候宽度会随内容的变化而变化,如果为div设置了宽度,超出的内容会显示在外面!你的应该是后者吧!如果不显示可以使用overflow属性!