在css中,可以利用“border-radius”属性设置button为直角,只需要给button元素添加“{border-radius:0%;}”或者“{border-radius:0px;}”样式即可。
本教程操作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。
css设置button为直角的方法
在css中可以使用border-radius属性来设置元素的圆角边框,border-radius属性的语法为:
border-radius: 1-4 length|% / 1-4 length|%;
其中需要注意的是:
立即学习“前端免费学习笔记(深入)”;
length用来定义圆角的形状,%用来以百分比定义圆角的形状。
button元素在默认情况下是有一些圆角的:
想要将button设置为直角,只需要给button元素添加“border-radius:0px;”或者“border-radius:0%;”样式即可。
示例代码如下:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <style> button{ border-radius:0%; } </style> <body> <button>123</button> </body> </html>
或者另一种形式:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <style> button{ border-radius:0px; } </style> <body> <button>123</button> </body> </html>
上述两种方法输出结果是相同的:
更多编程相关知识,请访问:编程视频!!
以上就是css怎样设置button为直角的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号