css类的两种使用方法

eg1:
<!DOCTYPE html>
<html>
<head>
<style>
p {text-indent:50px;}
</style>
</head>
<body>

<p>In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since. 'Whenever you feel like criticizing anyone,' he told me, 'just remember that all the people in this world haven't had the advantages that you've had.'</p>

</body>
</html>
			

css类的两种使用方法_第1张图片

eg2:

<!DOCTYPE html>
<html>
<head>
<style>
img.top {vertical-align:text-top;}
img.bottom {vertical-align:text-bottom;}
</style>
</head>

<body>
<p>An <img src="logo.png" alt="w3cschool" width="270" height="50" /> image with a default alignment.</p> 
<p>An <img class="top" src="logo.png" alt="w3cschool" width="270" height="50" /> image with a text-top alignment.</p> 
<p>An <img class="bottom" src="logo.png" alt="w3cschool" width="270" height="50" /> image with a text-bottom alignment.</p>
</body>
</html>
			
css类的两种使用方法_第2张图片

你可能感兴趣的:(html,css)