在css文字边距上怎么通过css的属性来设置?

html-css015

在css文字边距上怎么通过css的属性来设置?,第1张

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title>文字上边距</title>

<style>

*{

margin:0

padding:0

}

</style>

<body>

<div style="width:200pxheight:200pxpadding-top:20pxborder:1px solid red">

文字内容,padding:20px上边距20px。border:1px solid red1px的红色边框。width:200pxheight:200px宽度和高度200px。

</div>

</body>

</html>

外边距margin

上外边距margin-top

右外边距margin-right

下外边距margin-bottom

左外边距margin-left

内边距padding

上内边距padding-top

右内边距padding-right

下内边距padding-bottom

左内边距padding-left

padding-top:0px 或者margin-top:0px不过我看你CSS里面貌似没有上边距

你应该写一个*{margin:0pxpadding:0px} 写在最上面