I divided the Forum homepage into the header area, information area, content area, and footer area. First, use a large Div to include these items, mainly considering the convenience of the overall page adjustment. For example, to adjust them to a wide screen or a narrow screen, you just need to set this large Div.
First Code Paste it for debugging and use by friends.
CSS:
Copy code The Code is as follows:/* CSS document */
Body {
Background-color: # f5f5f5;
Margin: 0;
Padding: 0;
Font-family: "lucida Grande", verdana, lucida, Arial, Helvetica, sans-serif;
Font-size: 12px;
}
. Pagehoder {
Width: 100%;
Margin: auto;
Background-color: # 2662df;
Border-left: 2px solid #7197d7;
Border-Rider: 2px solid #7197d7;
Border-bottom: 2px solid #7197d7;
}
. Header {
Border-top: 2px solid #7197d7;
Height: 60px;
Background-color: # b1c3d9;
}
. LOGO {
Background: URL (../images/logo.png) No-Repeat;
Width: 200px;
Height: 60px;
Float: left;
}
. IMG {
Background: URL (../images/images1.jpg) Repeat-X;
Height: 60px;
}
. Navigate {
Padding-left: 20px;
Background-color: # f3f8fe;
Height: 10px;
}
. Navigate Li {
Float: left;
}
. Navigate Li {
Margin-left: 2px;
Padding-top: 3px;
Padding-bottom: 3px;
Text-align: center;
Display: block;
Text-Decoration: none;
Width: 70px;
Height: 10px;
Background-color: # ececec;
}
. Navigate Li A: hover {
Color: # ffffff;
Background-color: # bbbbbb;
}
. Notice {
Background-color: # ffffff;
Height: 20px;
}
. Content {
Background-color: # 0000ff;
Height: 400px;
}
. Contenthead {
Text-align: center;
Padding-top: 5px;
Padding-bottom: 0px;
Height: 20px;
Background-color: # 71a3cc;
}
. F1 {
Width: 60%;
Float: left;
Background-color: # 71a3cc;
}
. F2 {
Width: 12%;
Float: left;
Background-color: # 71a3cc;
}
. F3 {
Width: 12%;
Float: left;
Background-color: # 71a3cc;
}
. F4 {
Width: 15%;
Background-color: # 71a3cc;
}
. Typeholder {
Width: 100%;
Background-color: # d9dbe4;
}
. Type {
Width: 60%;
Float: left;
}
. Boardholder {
Text-align: center;
Width: 100%;
Background-color: # ffffff;
}
. Boardname {
Width: 60%;
Float: left;
}
. Subject {
Width: 12%;
Float: left;
Background-color: # f7f7f8;
}
. Article {
Width: 12%;
Float: left;
Background-color: # f7f7f8;
}
. Last {
Width: 15%;
Background-color: # f7f7f8;
}
. MSG {
Background-color: # fafafa;
Height: 60px;
}
. Footer {
Background-color: #99cc33;
Height: 20px;
Text-align: center;
}
.
HTML:Copy codeThe Code is as follows: <! Doctype HTML 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 = gb2312"/>
<Link href = "CSS/style.css" rel = "stylesheet" type = "text/CSS"/>
<Title> sclbbs homepage </title>
</Head>
<Body>
<Div class = "pagehoder">
<Div class = "Header">
<Div class = "logo">
</Div>
<Div class = "IMG"> </div>
</Div>
<Div class = "navigate">
<Li> <a href = "#"> homepage </a> </LI>
<Li> <a href = "#"> Search </a> </LI>
<Li> <a href = "#"> member list </a> </LI>
<Li> <a href = "#"> popular topics </a> </LI>
<Li> <a href = "#"> latest theme </a> </LI>
</Div>
<Div class = "notice">
<Marquee scrollamount = "2" width = "100%">
Welcome to sclbbs.
</Marquee>
</Div>
<Div class = "content">
<Div class = "contenthead">
<Div class = "f1"> layout </div>
<Div class = "F2"> topic </div>
<Div class = "F3"> Article </Div>
<Div class = "F4"> last post </div>
</Div>
<Div class = "typeholder">
<Div class = "type"> open-source project </div>
<Div class = "place"> </div>
</Div>
<Div class = "boardholder">
<Div class = "boardname"> jforum Forum </div>
<Div class = "subject"> 23 </div>
<Div class = "article"> 23 </div>
<Div class = "last"> 23 </div>
</Div>
<Div class = "typeholder">
<Div class = "type"> open source project 1 </div>
<Div class = "place"> </div>
</Div>
<Div class = "boardholder">
<Div class = "boardname"> jforum Forum 1 </div>
<Div class = "subject"> 23 </div>
<Div class = "article"> 23 </div>
<Div class = "last"> 23 </div>
</Div>
<Div class = "typeholder">
<Div class = "type"> open source project 2 </div>
<Div class = "place"> </div>
</Div>
<Div class = "boardholder">
<Div class = "boardname"> jforum Forum 2 </div>
<Div class = "subject"> 23 </div>
<Div class = "article"> 23 </div>
<Div class = "last"> 23 </div>
</Div>
<Div class = "typeholder">
<Div class = "type"> open source project 3 </div>
<Div class = "place"> </div>
</Div>
<Div class = "boardholder">
<Div class = "boardname"> jforum Forum 3 </div>
<Div class = "subject"> 23 </div>
<Div class = "article"> 23 </div>
<Div class = "last"> 23 </div>
</Div>
</Div>
<Div class = "MSG">
<Div class = "typeholder">
<Div class = "type"> who is online </div>
<Div class = "place"> </div>
</Div>
<Div class = "boardholder">
A total of 2,806 articles have been published
At present, there are a total of 4,186 registered members
Recently registered member: mxjccut
Currently, a total of 80 online users: 1 member, 79 guest [System Administrator] [Moderator]
The maximum number of online users is 2,712 [recorded at: 16:12:34]
Currently registered online member: Admin
</Div>
</Div>
<Div class = "footer">
Powered by sclbbs Author: sclsch@188.com
</Div>
</Div>
</Body>
</Html>
Images cannot be uploaded, but learning is not affected.
This is the first layout I designed. I learned from it that DIV is block and occupies the entire row by default. If you want to design it into two or more columns, you can use the float attribute, it can float to the left (float: Left). At this time, if the DIV below can be put down, it will float to the top row, forming a layout of two columns,
Multiple columns and so on. After understanding the basics, you can learn in the future. I hope to give some help to new art artists like me. It is also important to know about art developers.