CSS <hr>标记 画出的线 居左 怎么实现?

html-css06

CSS <hr>标记 画出的线 居左 怎么实现?,第1张

<hr>在chrome中默认是左对齐。在IE中默认是居中对齐,要想左对齐css中用text-align:left。

<hr style="text-align:left">或 <hr align="left">

<hr>的颜色设置

<hr style="border:0background-color:#ff0000height:1px">

如果不加border:0的话,虽然颜色改变了,但是会显示一条黑色的边框。如果不加height:1px的话,在chrome会显示不出来。

可以通过css的式样来控制:

1<hr align="center" width="700px" style= "border:1 dotted (这个表示虚线) #666666(颜色)" />

别的属性:

none:无样式;dotted:点线;dashed:虚线;solid:实线;

double:双线;groove:槽线;ridge:脊线;inset:内凹;outset:外凸。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html charset=utf-8" />

<title>分割线</title>

<style type="text/css">

div {

 height:1px

 width:100%

 background:#00CCFF

 overflow:hidden

 }

</style>

</head>

<body>

<div> </div>

</body>

</html>