css: basics and text

本文介绍了三种CSS选择器:直接应用于HTML元素的选择器、唯一选择器及普通选择器,并探讨了块级元素与行内元素的区别。此外,还详细解释了相对定位的方法及其属性设置技巧,包括'left'和'top'属性的应用。最后,文章列举了一些常见的文本属性,如颜色、字体系列、字号等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

three types of selector

 

1. directly apply to html element.

   

 

 

 

2. unique selector that occurs at most once in a html file.

 

   

 

3. normal selector that can occurs any times in one html file.

 

     

 

 

 

 

block element and line element.

Most of html elements are block elements, that means the content contained by a block element is viewed as a block, not a line. The rest are line elements such as '<em></em>'

 

 

 

position

The favorite position method is relative position.

Tips: 'left' and 'top' properties are available if the 'position' property is 'relavtive' or 'absolute'.

 details:

   For absolutely positioned elements, the left property sets the left edge of an element to a unit to the          left/right of the left edge of its containing element.

         For relatively positioned elements, the left property sets the left edge of an element to a unit to the left/right to its normal position.

For example:

 

         

 

 

 

text attributes

 

 

common attributes: color, font-family, font-size.

 

line spacing: line-height. The unit of value can be 'pt', 'em' and 'percentage', and 'em' and 'percentage' are recommended.

word spacing: word-spacing. The unit of value is same to line-height.

 

synthesis attribute: font, which is a synthesis of a bundle of attributes about real font.

 

The format of 'font' is 'font-style font-variant font-weight font-size/line-height font-family'.

 

For example: font: italic bold 12px/20px arial,sans-serif;

 

text decoration: text-decoration: underline | overline | linethrough | blink.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值