An example of a form layout div+css

Source: Internet
Author: User
css This is a layout test made yesterday! I feel that the form layout is very troublesome, and it is more difficult to solve the problem with the least code!

This is an example. I don't know if there is a better solution. Post it here and just look at it!

 Program code body {font-size: 12px; line-height: 1.9; text-align: center;}
#info {border: 1px solid # 006699; background: # F9EBBB; text-align: left; margin: 10px auto; width: 300px; padding: 10px 10px 10px 110px;}
#info label {width: 100px; display: block; float: left; text-align: right; margin-left: -100px! important; margin-left: -50px;}
#info input {border: 1px solid # 666699; height: 19px;}
#info h1 {font-size: 12px; margin: 0px;}
#info em {color: # FF0000; padding: 0 5px;}
#info div {color: # FF0000; border: 1px solid # FF0000; padding: 0 5px; background: # FCF9E2; margin: 2px 0; width: 140px;}
.bx {margin: 3px;}

 Program code <div id = "info">

  <h1> A test of form layout </ h1>
  <label> Your name: </ label>
  <input name = "" type = "text" />
  <em> * </ em> This is required! <br />
  
  <label> </ label>
  <div> The username is invalid! </ div>
  
  <label> Email: </ label>
  <input name = "" type = "text" />
  <em> * </ em> This is required! <br />
  
  <label> </ label>
  <div> Email error! </ div>
  
  <label> Address: </ label>
  <input name = "" type = "text" />
  <em> * </ em> This is required! <br />
  
  <label> URL: </ label>
  <input name = "" type = "text" />
  <em> * </ em> This is required! <br />
  
  <input type = "button" class = "bx" value = "submit" />
  
</ div>

 HTML code

<! DOCTYPEhtml 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 = utf-8" /> <title> Form example </ title > <style> / * zishu.cn * / body {font-size: 12px; line-height: 1.9; text-align: center;} # info {border: 1px solid # 006699; background: # F9EBBB; text-align : left; margin: 10px auto; width: 300px; padding: 10px 10px 10px 110px;) # info label {width: 100px; display: block; float: left; text-align: right; margin-left: -100px! important ; margin-left: -50px;} # info input {border: 1px solid # 666699; height: 19px;} # info h1 {font-size: 12px; margin: 0px;} # info em {color: # FF0000; padding : 0 5px;} # info div {color: # FF0000; border: 1px solid # FF0000; padding: 0 5px; background: # FCF9E2; margin: 2px 0; width: 140px;}. Bx {margin: 3px;} < / style> </ head> <body> <div id = "info"> <h1> A test of form layout </ h1> <label> Your name: </ label> <input name = "" type = " text "/> <em> * </ em> This is required Fill it out! <br /> <label> </ label> <div> The username is invalid! </ div> <label> Email: </ label> <input name = "" type = "text" /> <em> * </ em> This is required! <br /> <label> </ label> <div> Email error! </ div> <label> Address: </ label> <inputname = "" type = "text" /> <em> * </ em> This is required! <br /> <label> URL: </ label> <input name = "" type = "text" /> <em> * </ em> This is required! <br /> <input type = "button" class = "bx" value = "submit" </ div> </ body> </ html>

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.