设置文本框:四个直角边变为圆角(border-top-left-radius)

radius,就是半径的意思。用这个属性可以很容易做出圆角效果,当然,也可以做出圆形效果。原理很简单,“正方形的内切圆的半径等于正方形边长的一半”。

要想让文本框边角变得圆滑美观,主要是使用CSS3 border-top-left-radius 属性。

如图:  

 代码如下:
帐号:<input class="text"   name="UserName"  maxlength="30" style="border-color:blue; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px;  background-color: rgb(245,248,250); color: rgb(153, 153, 153);  font-weight: normal; position:relative; background-position: initial initial; background-repeat: initial initial;" value="" default_txt="帐号" type="text">
密码:<input class="text" style="border-color:blue; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px;  background-color: rgb(245,248,250); color: rgb(153, 153, 153); position: relative; background-position: initial initial; background-repeat: initial initial;" id="txtPassword" tabindex="2" name="Password" maxlength="30" default_txt="密码" type="password">
【红色代码就是设置文本框四个边角】
background-position 属性设置背景图像的起始位置
background-repeat 属性定义了图像的平铺模式



语法:

border-radius : none | <length>{1,4} [ / <length>{1,4} ]?

相关属性: border-top-right-radius , border-top-left-radius  , border-bottom-right-radius , border-bottom-left-radius , 

<!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=gb2312" />

<title>在HTML中如何把块的边框做成圆角</title>

<style type="text/css">

.a {

    background-color: #c7dec6;

    border: 1px solid #000;

    border-top-left-radius: 10px;

    border-top-right-radius: 10px;

border-bottom-left-radius: 10px;

border-bottom-right-radius: 10px;

height:200px;

width:500px;

padding:20px;

}

</style>

</head>

<body>

<p class="a">

在HTML中如何把块的边框做成圆角

</p>

</body>

</html>


在HTML中如何把块的边框做成圆角

样式注释

各个边角的样式分开显示:

border-top-left-radius: 10px;左上部边框圆角10个像素

border-top-right-radius: 10px;右上部边框圆角10个像素

border-bottom-left-radius: 10px;左下部边框圆角10个像素

border-bottom-right-radius: 10px;右下部边框圆角10个像素

全部边角一个样式:border-radius: 10px;所有边框圆角10个像素






  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值