html中如何去掉文本框的边框

html-css07

html中如何去掉文本框的边框,第1张

可以用border属性去除文本框的边框。

1、新建html文档,在body标签中添加一些input标签,这时默认情况下浏览器中的文本框有1px的边框:

2、在head标签中添加style标签,设置input的样式,这里为了演示方便,为文本框设置灰色的背景色:

3、为input标签设置边框“border”属性,属性值为“0”,这时网页中文本框的边框就被去掉了:

border="0"可以去除边框以下是关于border的一些相关资料:定义和用法border

属性在一个声明中设置所有边框属性。语法:Object.style.border=borderWidth

borderStyle

borderColorborderWidth

设置边框的宽度。

thinmediumthicklengthborderStyle

设置边框的样式。

nonehiddendotteddashedsoliddoublegrooveridgeinsetoutsetborderColor

设置边框的颜色。

color-namecolor-rgbcolor-hextransparent实例本例改变元素的边框:<html><head><style

type="text/css">p{

border:

thin

dotted

#FF0000}</style><script

type="text/javascript">function

changeBorder(){document.getElementById("p1").style.border="thick

solid

#0000FF"}</script></head><body><input

type="button"

onclick="changeBorder()"value="Change

border"

/><p

id="p1">This

is

a

paragraph</p></body></html>