HTML的基本操作

html(超文本标记语言),主要应用到web网站上

padding: 内边距,属性定义元素边框与元素内容之间的空间

margin:外边距,标签外的空间,当padding和margin为0时,则全部充满页面不会留下白边

class:定义一个类,在css中起作用,调用时用.(名字),权重值为10

id:同样是在css中起作用用#调用,权重值为100

*:同上所述,权重值为1

直接在标签后面加样式,权重值最大,1000

<img scr="">图片标签

元素的浮动:创建三个个div,用float属性给他们添加left,则会充满一行

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>元素的浮动</title>
    </head>
    <style>
        .gress{
            background: green;
            width: 20%;
            height: 200px;
            float: left;
        }
        .red{
            background: red;
            width: 60%;
            height: 200px;
            float: left;
        }
        .bule{
            background: blue;
            width: 20%;
            height: 200px;
            float: left;
        }
    </style>    
    <body style="margin: 0;padding: 0;" >
    <div class="gress">     </div>    
    <div class="red">        </div>
    <div class="bule">        </div>
    
    </body>
</html>
View Code

如果想在浮动的框架下面继续添加区块的话,必须去浮动,否则,新添加的区块会有一部分被浮动框架覆盖

一定要给之前浮动的框架设置一个大的框架,并且要给他设定宽度

去除浮动的方法:

clear:清除浮动

overflow:auto      溢出,撑满父元素,不需要给父元素设置高度

auto:自动设置

no-repeat :在css中,设置背景图片不重复

如果想让多个图片居中,则需要设置他的边距,在使用auto进行自动填充

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>区域图片的居中</title>
    <style type="text/css">
        *{
            margin: 0;
        }
        .one,.two,.three{
            width: 210px;
            height: 150px;
            background: url(901.jpg);
            float: left;
            margin: 20px;
        }
        #dies{
            overflow: auto;
            margin: auto;
            width: 750px;
            
        }
        
        
        
    </style>    
    </head>
<body>
    <div id="dies">
    <div class="one">        </div>
    <div class="two">        </div>
    <div class="three">        </div>
    </div>
    
    
</body>
</html>
View Code

border:边框    solid:实线 

原文地址:https://www.cnblogs.com/Alom/p/11917937.html