CSS for button buttons set padding style invalid solution

Source: Internet
Author: User

When you use CSS to set the padding style for the button, the discovery does not work. Directly on the code:

The code is as follows Copy Code

<! DOCTYPE html>
<meta charset= "UTF-8" >
<title>Document</title>
<style type= "Text/css" >
Body, form, UL, Li {margin:0;padding:0;}
Body {height:100%;font-family: "Microsoft Ya Black", "bold"; Background-color: #298bd2;}
Ul{list-style:none;}
. mt-80{margin-top:80px;}
. mt-30{margin-top:30px;}
#userNameIn, #pwdIn, #loginBtn {
Display:block;
padding:25px 30px;
font-size:40px;
width:80%;
line-height:50px;
height:50px;
Color: #333;
Background-color: #fff;
border:0 none;
margin:0 Auto;
}
#userNameIn {
border-radius:10px 10px 0 0;
border-bottom:1px solid #ddd;
}
#pwdIn {
border-radius:0 0 10px 10px;
}
#loginBtn {
border-radius:10px;
Cursor:pointer;
}
</style>
<body>
<form action= "javascript:;" method= "POST" >
<ul class= "mt-80" >
<li><input id= "Usernamein" type= "text" placeholder= "username"/></li>
<li><input id= "Pwdin" type= "password" placeholder= "password"/></li>
<li class= "mt-30" ><button id= "loginbtn" type= "button" > Login </button></li>
</ul>
</form>
</body>

The code effect is as shown. The login button on the page is set to the same style as the other two input boxes, but the login button is not propped up.

Original by:input[type= "button"], input[type= "Submit"], input[type= "reset"], input[type= "file"]::- Webkit-file-upload-button, button
The box-sizing properties of these elements are set by the browser defaults to Border-box;

When the box-sizing of an element is set to Border-box, its interior margins and borders are included in the width and height, which means that its width and height determine the height and width of the box.

So add a style Box-sizing:content-box to the #loginbtn, or reset it to a wide-high value. The normal effect is the following figure:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.