我有以下css ......
<style type="text/css">
.widediv{width:1366px;margin-left:auto;margin-right:auto}
</style>
...这让我创建了我的页面:
<body><div class="widedivv">
<!-- Stuff -->
<div style="background-color:#609ED2"> <!-- Stuff again --> </div>
</div></body>
但我使用的是1600 * 900px的屏幕,我相信这是一种干净的方式来做我想要的事情:
如何将div的颜色应用到屏幕/页面的左侧?
因为在这种情况下,将保留具有此宽度的白色边距:
(ScreenWidth-1366)/2
答案 0 :(得分:0)
<form action="7_dest.php" method="POST">
<p>First name:<input type="text" name="fname" step=0> </p>
<p>Last name:<input type="text" name="lname" step=0> </p>
<p>Age:<input type="number" name="age"> </p>
<p>E-mail:<input type="email" name="email" step=0> </p>
<p>Confirm E-mail:<input type="email" name="emailb" step=0> </p>
<p><input type="submit"> </p>
</form>
并按如下方式应用css
<body>
<div class="outer-widediv">
<div class="widedivv">
<!-- Stuff -->
<div style="background-color:#609ED2"> <!-- Stuff again --> </div>
</div>
</div>
</body>
答案 1 :(得分:0)
这是你喜欢的吗?
HTML
<body><div class="widediv">
<div style="background-color:blue; padding-left:350px">
Stuff here
</div>
</div>
< I'd like the color of the div to get to there !
</body>
CSS
.widediv{background-color:blue;width:1366px;margin-right:auto}