HTML元素用法

Ordered Lists:

HTML:
<!DOCTYPE html>
<html>
	<head>
		<title>Lists</title>
	</head>
	<body>
		<h1>List of my favorite things</h1>
			<ol>
				<li>raindrops on roses</li>
				<li>whiskas on kittens</li>
				<li>call of duty: modern warfare</li>				
			</ol>
		
		
	</body>
</html>

效果:


粗体:

<strong></strong>

斜体:

<em></em>

表格:

HTML:
<html>
    <head>
        <title>Table Time</title>
    </head>
    
    <body>
        
        <table style="border-collapse:collapse;">
            <thead>
                <tr>
                    <th colspan="2" style="color:red">Famous Monsters by Birth Year</th>
                </tr>
                <tr style="border-bottom:1px solid black;">
                    <th style="padding:5px; color:red"><em>Famous Monster</em></th>
                    <th style="padding:5px;border-left:1px solid black;color:red"><em>Birth Year</em></th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td style="padding:5px;">King Kong</td>
                    <td style="padding:5px;border-left:1px solid black;">1933</td>     
                </tr>
                
                <tr>
                    <td style="padding:5px;">Dracula</td>
                    <td style="padding:5px;border-left:1px solid black;">1897</td>
                </tr>
                
                <tr>
                    <td style="padding:5px;">Bride of Frankenstein</td>
                    <td style="padding:5px;border-left:1px solid black;">1944</td>
                </tr>
            </tbody>
        </table>
        
    </body>

</html>

效果图:



字体大小:

<!DOCTYPE html>
<html>
	<head>
		<title>Result</title>
	</head>
	<body>
		<p style="font-size: 1em">One em!</p>
		<p style="font-size: 0.5em">Half an em!</p>
		<p style="font-size: 2em">TWO EM!</p>
	</body>
</html>

em:  the font-size util em is a relative measure: one em is equal to the default font size on whatever screen the user is using

<a>标签:

CSS中<a>标签的text-decoration attributes可以将下划线去掉。


CSS的selectors:

see how the classes and IDs alter the way the paragraph looks? (Note how the li p { CSS overrides the p { CSS, and the .list_item overrides the li p { CSS.)

class: 为一类元素使用 .name
id: 为单独一个元素使用 #name


Pseudo-Class Selectors:

Links:

a:link     :  unvisited link
a:visited:  a visited link
a:hover :  a link that you are hovering your mouse over.

Child:

first-child: another useful pseudo-class selector is first-child. It's used to apply styling to only the elements that are the first children of their parents
nth-child: 

Display(box model):


block: This makes the element a block box. It won't let anything sit next to it on the page! It takes up the full width
inline-block: this makes the element a block box, but will allow other elements to sit next to it on the same line
inline: this makes the lement sit on the same line as another element, but without formatting it like a block. It only takes up as much width as it needs
none: this makes the element and its content disappear from the page entirely.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值