CSS fundation [note]

4 ways to use CSS:

1. inline:

<p style="color:#F00; font-size:12px;"></p>

 

2. embedded:
<head>

    <style type="text/css">

    .......

    </style>

</head>

 

3. link

<link type="text/css" rel="stylesheet" href="style.css"/>

 

4. import

@import import css file while initialization be a part of a file

 

selector:

tag:       p{ }

id:        #one{ }

class:       .one{ }

general:    *{ }

 

nested selector:   #div1 p a {color:#900;}  

 

 

 

 



block vs inline
 blockinline
width & heightYESNO
allow others be in same lineNO

YES



inline to block:   display:block;

 

margin: 1px 2px 3px 4px; top right bottom left ( t r ou b l e)

 

clear float:

.clear{ clear: both;}

<div class="clear"></div>

 

vertical center:

line-height = height (text)

 

absolute position:

margin-left = -width/2

margin-right = -height/2

position:absolute;

top:50%;

left:50%;

(if parent element exists, parent element's position should be relative)

 

Text horizontal center:

text-align: center;

 

Reset:

tags reset: *{margin:0px; padding:0px;}   body,div,p,a,ul,li{margin:0px; padding:0px;} (group declaration)

img border reset: img{border:none;}

font size reset: h1{font-size:100%;}

 

Pseudo classes:

:link  (unvisited links)
:visited  (visited links)
:active (clicked link)
:hover (mouse above)
 
 
 

 

 

 

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值