标签:utf-8 ack 区别 lan charset padding type round add
width: 100%;浏览器窗口多出滚动条左右有30px的padding
width: auto;未设置auto,则默认auto,浏览器撑满显示
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
* {
margin: 0;
padding: 0;
}
/*
width: 100%;浏览器窗口多出滚动条左右有30px的padding
width: auto;未设置auto,这默认auto,浏览器撑满显示
*/
#test {
width: 100%;
padding: 0 30px;
height: 300px;
background-color: pink;
}
</style>
</head>
<body>
<div id="test"></div>
</body>
</html>
【CSS__宽度】css width: auto;和width: 100%;的区别
标签:utf-8 ack 区别 lan charset padding type round add
原文地址:https://www.cnblogs.com/kikyoqiang/p/13198397.html