怎样用css把文本框变成圆角

html-css024

怎样用css把文本框变成圆角,第1张

border-radius属性可以实现元素的圆角。如下css可以实现文本框(单行、多行)的圆角:

input[type=text],textarea{border-radius:3pxborder:1px solid #000}

border-radius用法如下:

border-radius 属性是一个简写属性,用于设置四个 border-*-radius 属性。

该属性允许为元素添加圆角边框

语法:

border-radius: 1-4 length|% / 1-4 length|%

按此顺序设置每个 radius 的四个值。

如果省略 bottom-left,则与 top-right 相同。

如果省略 bottom-right,则与 top-left 相同。

如果省略 top-right,则与 top-left 相同。

单位一般用px和百分比较多,其他单位也可

方法一:CSS3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns=" http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/htmlcharset=utf-8" /><meta http-equiv="Content-Language" content="utf-8" /><meta name="robots" content="all" /><meta name="author" content="Tencent-ISRD" /><meta name="Copyright" content="Tencent" /><title>Border-radius</title></head><body><div style="border-width: 1pxborder-style: solid-moz-border-radius: 11px-khtml-border-radius: 11px-webkit-border-radius: 11pxborder-radius: 11pxpadding:5px">在Firefox和Safari 3的浏览器里能看到圆角效果</div></body></html>方法二:CSS2 先做好四个圆角背景图,再定义四个角的类,如:.TL .TR .BL .BR。 四个角使用绝对定位,定位在层的左上、右上、左下、右下位置