Home  >  Article  >  Web Front-end  >  How to set the input box to be circular in css

How to set the input box to be circular in css

WBOY
WBOYOriginal
2021-11-29 11:57:344905browse

Method: 1. Add the "width: diameter value; height: diameter value;" style to the input box element and set the input box to a square; 2. Use the "border-radius" attribute to set the square input box To make it circular, you only need to add the "border-radius:100%;" style to the input box.

How to set the input box to be circular in css

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

How to set the input box to a circle in css

In css, you can first set the input box to a square and then set the circle of the input box Corner can be used to set the input box to be circular.

At this time, you need to use the border-radius attribute. The function of this attribute is to set the rounded border of the element.

The example 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>123</title>
    <style type="text/css">
    .myinput{
        width:100px;
        height:100px;
        border-radius:100%;
    }
</style>
  </head>
  <body>
<input type="text" value="" class="myinput" placeholder="这是一个input"/>
  </body>
</html>

Output result:

How to set the input box to be circular in css

(Learning video sharing: css video tutorial)

The above is the detailed content of How to set the input box to be circular 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