css笔记(就是书中的一些摘抄^_^)

divs should be used to group related items based on their meaning or
function rather than their presentation or layout.

Whereas divs can be used to group block-level elements, spans can be used to group or
identify inline elements:
div只是一个分块的标签,他可以将网页分成几个区块。div里面可能包含一个标题,一个段落,也可能包含图片在内的很多元素,甚至div也可以再包含div。而span是行级元素(行内标签),通常情况下它都用来定义一小段文字的样式。它们的另一个区别就是div会造成换行,而span则不会。

Unfortunately, IE 6
automatically switches to quirks mode if the DOCTYPE declaration is not the first element
on a page. Therefore, unless you are serving your pages as XML documents, it is best to
avoid using an XML declaration

The most common kinds of selectors are type and descendant selectors

可以用id指定某一个元素,用class指定某一类元素

ID selectors are identified using a hash character; class selectors are identified
with a period.

:link and :visited are known as link pseudo-classes and can only be applied to anchor
elements. :hover, :active, and :focus are known as dynamic pseudo-classes and can
theoretically be applied to any element.

Child and adjacent sibling selectors
Attribute selectors

a rule written in a style
attribute will always be more specific than any other rule. A rule with an ID will be more
specific than one without an ID, and a rule with a class selector will be more specific than
a rule with just type selectors. Finally, if two rules have the same specificity, the last one defined prevails.

--------------------------------------------------------------------------------------------
Every element on the page is
considered to be a rectangular box made up of the element’s content, padding, border,
and margin

Margin collapsing  
Margin collapsing only happens with the vertical margins of block boxes in the normal
flow of the document. Margins between inline boxes, floated, or absolutely positioned
boxes never collapse.

There are three basic positioning schemes in CSS: normal flow, floats, and absolute positioning.

Block-level boxes will appear vertically one after the other; the vertical distance between
boxes is calculated by the boxes’ vertical margins.Inline boxes are laid out in a line horizontally.

An absolutely positioned element is positioned in relation to its nearest positioned ancestor.

Gradients
Tiling images

在css中,任何东西都可用看成一个element

以div为例,它的大小默认和content area的相同,如果设置了padding等的话,content的大小不变,但是div的大小会增加。

Image Replacement
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值