Home  >  Article  >  Web Front-end  >  How to set button to right angle in css

How to set button to right angle in css

WBOY
WBOYOriginal
2021-11-17 17:16:403424browse

In CSS, you can use the "border-radius" attribute to set the button to a right angle. You only need to add "{border-radius:0%;}" or "{border-radius:0px;}" to the button element. "Style is enough.

How to set button to right angle in css

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

How to set the button to a right angle in css

In css, you can use the border-radius attribute to set the rounded border of the element, border- The syntax of the radius attribute is:

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

It should be noted that:

length is used to define the shape of the rounded corners, and % is used to define the shape of the rounded corners in percentage.

The button element has some rounded corners by default:

How to set button to right angle in css

If you want to set the button to a right angle, you only need to add "border" to the button element -radius:0px;" or "border-radius:0%;" styles are sufficient.

The sample code is as follows:

<!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>

Or another form:

<!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>

The output results of the above two methods are the same:

How to set button to right angle in css

For more programming-related knowledge, please visit: Programming Video! !

The above is the detailed content of How to set button to right angle in css. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn