search
HomeWeb Front-endHTML TutorialCSS perfect DIV CSS layout_html/css_WEB-ITnose

--Tip: First set the border: solid 1px blue in the CSS style of each larger DIV and then remove it after adjusting the overall layout.

1. Get the outermost frame first

View Code

1 <div id="outterDiv">2 3 </div>

2. Add CSS immediately

View Code

1 <style type="text/css">2 3 #outterDiv{ width:600px; }4 5 </style>

3. Analyze the left and right structure of the layout

View Code

1 <div class="InnerDiv">2 3 </div>4 5 <div class="InnerDiv">6 7 </div>

4. Add CSS

View Code

1 .InnerDiv { width:49%; float:left; overflow:hidden; margin-left:5px; display:inline; }

5. Analyze as left-right-bottom structure

View Code

 1 <div class="LeftDiv"> 2  3 </div> 4  5 <div class="RightDiv"> 6  7 </div> 8  9 <div class="DownDiv">10 11 </div>

6. Add CSS

View Code

1 .LeftDiv { width:200px; float:left; margin-left:17px;margin-top:10px; display:inline; }2 .RightDiv { width:40px; float:left; display:inline; margin-left:5px; margin-top:100px; }3 .DownDiv { width:200px; text-align:center;margin-bottom:8px; }

7. The left part is divided into two DIVs, upper and lower DIV

View Code

<div class="NameDiv"></div><div class="SortDiv"></div>

8. Add CSS

View Code

1 .NameDiv { width:100%; }2 .SortDiv { width:100%; }

9. Fill each DIV content

10. All codes

View Code

 1 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <head runat="server"> 3      <title>排序管理</title> 4      <style type="text/css"> 5          #outterDiv{ width:600px; } 6          .InnerDiv { width:49%; float:left; overflow:hidden; margin-left:5px; display:inline; } 7          .LeftDiv { width:200px; float:left; margin-left:17px;margin-top:10px; display:inline; } 8          .RightDiv { width:40px; float:left; display:inline; margin-left:5px; margin-top:100px; } 9          .DownDiv { width:200px; text-align:center;margin-bottom:8px; }10          .NameDiv { width:100%; }11          .SortDiv { width:100%; }12 </style>13 </head>14 <body style="font-size:12px;">15      <form id="form1" runat="server">16          <div id="outterDiv">17              <div class="InnerDiv">18                  <fieldset>19                  <legend>20                      <font style='font-size:12px;'>部门管理</font>21                  </legend>22                  <div class="LeftDiv">23                      <div class="NameDiv">24                          部门维护:<br />25                          <asp:TextBox ID="tbDept" runat="server" Width="200px"></asp:TextBox>26                      </div>27                      <div class="SortDiv">28                          部门排序:<br />29                          <asp:ListBox ID="LibDeptOrder" runat="server" Height="250px" Width="200px" AutoPostBack="true"30                          onselectedindexchanged="LibDeptOrder_SelectedIndexChanged"></asp:ListBox>31                      </div>32                  </div>33                  <div class="RightDiv">34                      <asp:Button ID="btnDeptUp" runat="server" Text="上移" onclick="btnDeptUp_Click" />35                      <br />36                      <asp:Button ID="btnDeptDown" runat="server" Text="下移" onclick="btnDeptDown_Click" />37                  </div>38                  <div class="DownDiv">39                      <asp:Button ID="btnDeptSave" runat="server" Text="保存" onclick="btnDeptSave_Click" />40                      <asp:Button ID="btnDeptDel" runat="server" Text="删除" onclick="btnDeptDel_Click" />41                  </div>42                  </fieldset>43              </div>44              <div class="InnerDiv">45                  <fieldset>46                  <legend>47                      <font style='font-size:12px;'>职位管理</font>48                  </legend>49                  <div class="LeftDiv">50                      <div class="NameDiv">51                          职位维护:<br />52                          <asp:TextBox ID="tbPosi" runat="server" Width="200px"></asp:TextBox>53                      </div>54                      <div class="SortDiv">55                          职位排序:<br />56                          <asp:ListBox ID="libPosiOrder" runat="server" Height="250px" Width="200px" AutoPostBack="true"         57                          onselectedindexchanged="libPosiOrder_SelectedIndexChanged"></asp:ListBox>58                      </div>59                  </div>60                  <div class="RightDiv">61                      <asp:Button ID="btnPosiUp" runat="server" Text="上移" onclick="btnPosiUp_Click" />62                      <br />63                      <asp:Button ID="btnPosiDown" runat="server" Text="下移" onclick="btnPosiDown_Click" />64                  </div>65                  <div class="DownDiv">66                      <asp:Button ID="btnPosiSave" runat="server" Text="保存" onclick="btnPosiSave_Click" />67                      <asp:Button ID="btnPosiDel" runat="server" Text="删除" onclick="btnPosiDel_Click" />68                  </div>69                  </fieldset>70              </div>71          </div>72      <input type="hidden" id="hidUnitID" runat="server"/>73      </form>74 </body>75 </html>











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
From Text to Websites: The Power of HTMLFrom Text to Websites: The Power of HTMLApr 13, 2025 am 12:07 AM

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

Understanding HTML, CSS, and JavaScript: A Beginner's GuideUnderstanding HTML, CSS, and JavaScript: A Beginner's GuideApr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The Role of HTML: Structuring Web ContentThe Role of HTML: Structuring Web ContentApr 11, 2025 am 12:12 AM

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

HTML and Code: A Closer Look at the TerminologyHTML and Code: A Closer Look at the TerminologyApr 10, 2025 am 09:28 AM

HTMLisaspecifictypeofcodefocusedonstructuringwebcontent,while"code"broadlyincludeslanguageslikeJavaScriptandPythonforfunctionality.1)HTMLdefineswebpagestructureusingtags.2)"Code"encompassesawiderrangeoflanguagesforlogicandinteract

HTML, CSS, and JavaScript: Essential Tools for Web DevelopersHTML, CSS, and JavaScript: Essential Tools for Web DevelopersApr 09, 2025 am 12:12 AM

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

The Roles of HTML, CSS, and JavaScript: Core ResponsibilitiesThe Roles of HTML, CSS, and JavaScript: Core ResponsibilitiesApr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

Is HTML easy to learn for beginners?Is HTML easy to learn for beginners?Apr 07, 2025 am 12:11 AM

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

What is an example of a starting tag in HTML?What is an example of a starting tag in HTML?Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools