Yesterday I made a form and still used the table layout, because I personally feel that the table layout form is good (pursuing div refactoring is not equal to completely abandoning the table ).
When I got up this morning, I thought it was another way to layout the form. Then we chose dl, dd, and dt, as shown below:
XHTML section:
The code is as follows: |
Copy code |
<Dl> <Dt> Company name: </dt> <Dd> <input name = "text" type = "text" value = "Guangzhou Junbao Industrial Co., Ltd." size = "50"/> <span class = "red"> * </span> </dd> <Dt> Company industrial Category: </dt> <Dd> <select name = "select"> <option> computer and consumer electronics </option> </select> <Select name = "select"> <option> air conditioner </option> </select> <span class = "red"> * </span> </dd> <Dt> Company Profile: </dt> <Dd> <textarea name = "textarea" cols = "100" rows = "9"> Founded in 1990, Guangzhou Junbao Industrial Co., Ltd, it integrates scientific research, manufacturing, sales, and service, it is a large-scale economic entity with research and development center, mold design and manufacturing center, electronic and circuit control design and manufacturing center, injection processing and product whole machine production base. Junbao's production base covers an area of approximately 30000 m² square meters and has excellent equipment and powerful production capabilities. In accordance with the specifications and management of modern enterprises, the company adheres to the spirit of integrity, innovation, diligence, and enterprising, and continues to grow and grow. Junbao has a talent collection, with 326 employees and R & D staff... </textarea> <span class = "red"> * </span> </Dd> </Dl>
|
CSS section:
The code is as follows: |
Copy code |
Dl {padding-left: 14px ;} Dt {float: left; font-weight: bold; padding: 12px 0 4px ;} Dd {text-align: left; height: auto; padding: 8px 0 ;} Input, select {vertical-align: middle; color: #333333; background: # ffffff; font: 12px Arial, Helvetica, sans-serif ;} Textarea {color: #333333; background: # ffffff; font: 12px Arial, Helvetica, sans-serif; line-height: 150%; overflow: auto}
|
Note: We recommend that you do not use height or line-height for dl, dt, or dd settings. If FF is used, the deviation may occur because IE and FF are adaptive, we recommend that you use the padding attribute of dt and dd to locate it!