html与body宽度,HTML和body标签的边距,填充,高度和宽度

本文探讨了HTML和CSS中元素的边距、填充、高度、宽度以及定位属性。在HTML中,设置body的背景颜色、宽度和高度,并通过margin和padding调整布局。CSS中,body使用固定定位,调整top和left属性改变位置,同时关注不同属性对页面布局的影响。此外,还讨论了header元素的尺寸和位置设定。
摘要由CSDN通过智能技术生成

我编写了这段代码,以便了解下面代码的边距,填充和位置。问题在这些/ * * /之间。再次感谢。HTML和body标签的边距,填充,高度和宽度

html{

width:auto; /* Does auto will apply the background-color automatically to the display screen */

height:100%; /* 100% means 100% of the display browser??*/

margin-left:1%; margin-right:1%; /*does changing the value of the margin will change anything in the page*/

margin-top:1%;margin-bottom:1%;

padding-left:1%;padding-right:1%;

padding-top:1%;Padding-bottom:0%;

border: 1px solid black;

background-color: red;

}

body{

background-color: #00FF00;

width:50%; /* does it means 50% of the width stated above in the html (auto)*/

height:50%; /*does it means 50% of the height of the display browser or we have to add the padding-top(1%) in html*/

position: fixed;

top: 25%; /* does it mean that the body is shifted to below 25% of it's heigh or 25% of the display browser? */

left:25%; /* what is the different if i give 0% to left and i changed the margin-left value to 25%*/

border: 2px solid black ;

margin-top: 0px;

margin-left: 0px;}

header{width:50%;height:auto;

top: 25%;left:25%; /* what does it mean here the value given to top and left??*/

border: 2px solid black ;

margin-top: 10%;

margin-left: 25%;}

h1{margin: 5px; color: blue;}

MY First webpage

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值