css如何用灰色直线写出一个方框

html-css012

css如何用灰色直线写出一个方框,第1张

<html>

<head>

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

<title>无标题文档</title>

<style type="text/css">

#c1{

width:70px

height:30px

border:solid 1px #CCC}

</style>

</head>

<body>

<div id="c1"></div>

</body>

</html

这里 就能写出一个框70px,高30px,的方框了,如果要调整方框的大小,直接改width和height的值就行

CSS代码如下

border-bottom: 2px solid red

代码解释:

border-bottom: 表示下边框

2px:表示边框宽度

solid:实现边框

red:红色

用css3动画去做

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>00</title>

<style>

.xian{ width:50px height:1px background:#000000 margin-top:100px}

.xian{animation: myfirst 5s}

@keyframes myfirst

{

from {width: 50px}

to {width: 1000px}

}

</style>

</head>

<body>

<div class="xian"></div>

</body>

</html>

低版本浏览器不支持css3属性,用谷歌什么的高版本浏览器看。