CSS描述了网页的布局

1.CSS格式

CSS 规则由两个主要的部分构成:选择器,以及一条或多条声明;CSS声明总是以分号(;)结束,声明组以大括号({})括起来:

.style{color:red;text-align:center;}

2.CSS 注释:/**/

3.CSS 选择器
HTML元素以id属性来设置id选择器,CSS 中 id 选择器以 "#" 来定义

#terminal
{
text-align:center;
color:red;
}

class 选择器在HTML中以class属性表示, 在 CSS 中,类选择器以一个点"."号显示

.center {text-align:center;}

指定特定的HTML元素使用class

p {text-align:center;}


4.CSS 创建
插入样式表的方法有三种:内联样式)Inline style > (内部样式)Internal style sheet >(外部样式)External style sheet > 浏览器默认样式

外部样式表(External style sheet)

<head>
<link rel="stylesheet" href="../css/box.css">
</head>

内部样式表(Internal style sheet)

<head>
<style>
.bigBox{overflow:hidden;left: 0px; right: 0px;width: 100%;}
.LeftBox { float: left;width: 63%; height:98%; margin-top:1%;margin-bottom:1%;margin-left:1%;margin-right:1%;}
.RightBox { float: left;width: 33%; height:98%; margin-top:1%;margin-bottom:1%;margin-left:1%;margin-right:1%;}
.box {
position: relative; 
background: #003; 
border-top: 1px solid #d2d6de;
border-top-color: #383838; 
}
</style>
</head>

内联样式(Inline style)

<div id="full" class="bigBox" style="height:1000px;">

 

posted @ 2017-07-29 21:38  corolcorona  阅读(294)  评论(0编辑  收藏  举报