html 3

div{}

#id{

}

.class_name{

}

CSS引入方式

1. 写在标签内部的 style=" " 属性里 内嵌样式表

2. 写在<head>部分中的<style type="text/css"></style> 内部样式表

3. 写在<link type="text/css" rel="stylesheel" href="xxxxx.css" /> 链入外部样式表

4. 在<style></style>中使用 @import url(**.css); 导入 CSS 别少了分号!!!!! 导入外部样式表

元素标签 并排在一行 使用 float CSS 属性  

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>Document</title>
    <style>
        #header{
            height:200px;
            background:blue;
            color:white;
            float:left;
        }
        #content{
            height:200px;
            background:green;
            color:white;
            float:left;
        }
        #footer{
            height:200px;
            background:grey;
        }
    </style>
</head>
<body>
        <div id="header">Header</div>
        <div id="content">Content</div>
        <div id="footer">Footer</div>
</body>
</html>
原文地址:https://www.cnblogs.com/zy2012/p/3724340.html