The layout is initially set up, I started to fill the content inside. The first is to define logo pictures:
Style sheet:
#LOGO {margin: 0px; padding: 0px; width: 200px; height: 80px;
Page code:
The above code should now be easily understood. First define a logo layer in CSS, then call it on the page. It should be noted that in order to make the webpage have better ease of use, the web standard requires everyone to give a picture that belongs to the official content, add an Alt property. This alt property is used to explain the role of the image (the replacement text is displayed when the image cannot be displayed), so don't just write a meaningless picture name.
Next is the definition menu.
1. Don't use the menu (portrait)
Let's first see the ultimate effect of the menu:
Usually, we are at least 2-layer tables to implement such menus, and the interval line is implemented in TD and inserted 1PX high transparent GIF picture implementation; background color alternating effects use TD's onmouseover event implementation. But check the page code of this menu, you will see only as follows:
ul>
div>
There is no use of any table, and the secrets of the effect of the entire menu are completely id = "menu", let's see the definition of MENU in CSS:
(1) First define the main style of the MENU layer:
#menu {
Margin: 15px 20px 0px 15px; / * Define the outer frame of the layer * / padding: 15px; / * Define the inner side of the layer is 15px * /
Background: #dfdfdf; / * Define background color * /
Color: # 666; / * Define font color * /
Border: #fff 2px solid; / * Define the border to 2px white line * /
Width: 160px; / * Define the width of 160px * /
}
(2) Secondly define the style of unordered list:
#menu ul {
Margin: 0px;
Padding: 0px;
Border: Medium none; / * does not display the border * /
Line-height: Normal;
List-style-type: none;
}
#menu li {border-top: #fff 1px solid; margin: 0px;}
Description: This is the derived method definition of the ID selector (refer to day 7: Introduction to CSS Getting Started) The style of child elements
#menu li a {
Padding: 5px 0px 5px 15px;
Display: block;
Font-weight: bold;
BACKGROUND: URL (images / icon_dot_lmenu.gif) Transparent No-Repeat 2px 8px;
Width: 100%;
Color: # 444;
Text-decoration: none;
}
#menu Li A: Hover {Background: URL (images / icon_dot_lmenu2.gif) # c61c18 no-repeat 2px 8px;
Color: #fff;}
The following: "Display: block;" indicates that the label A is displayed as a block element element, so that the link becomes a button; "Background: URL (images / icon_lmenu.gif) Transparent No-repeat 2px 8px;" This sentence definition An icon for replacing a small dot of Li. "Transparent" means the background is transparent, "2px 8px" specifies the location of the icon at the left 2px, 8px from the upper side. This sentence can also be split into four sentences: "Background-Image: URL (images / icon_dot_lmenu.gif); Background-Position: 2px 8px; Background-Repeat: no-repeat; background-color: transparent;" # Menu Li A: hover "Defines the color change and small icon changes when the mouse moves to the link. OK, the menu that doesn't have a table is implemented. Everyone can feel clear that the performance style written in HTML is all stripped to the CSS file. The page code saves most. It is very simple to modify the menu style through CSS. 2. Menu (horizontal) without the table is a longitudinal menu, if you want to display the horizontal menu, can you use Li? Of course, it is ok, the code is given below, the effect is on top of this page: page code
ul>
div>
Style table code
#submenu {
Margin: 0px 8px 0px 8px;
Padding: 4px 0px 0px 0px;
Border: #fff 1px solid;
Background: #dfdfdf;
Color: # 666;
HEIGHT: 25PX;
#SubMenu ul {
CLEAR: LEFT;
Margin: 0px;
Padding: 0px;
Border: 0px;
List-style-type: none;
TEXT-ALIGN: CENTER;
DISPLAY: INLINE
}
#submenu li {
FLOAT: LEFT;
Display: block;
Margin: 0px;
Padding: 0px;
TEXT-ALIGN: CENTER}
#submenu Li a {
Display: block;
Padding: 2px 3px 2px 3px; Background: URL (images / icon_dot_lmenu.gif) Transparent No-Repeat 2px 8px;
Font-weight: bold;
Width: 100%;
Color: # 444;
Text-decoration: none;
}
#Submenu Li A: Hover {
Background: URL (images / icon_dot_lmenu2.gif) # c61c18 no-repeat 2px 8px;
Color: #fff;}
#submenu ul li # one a {width: 60px}
#submenu ul li # two a {width: 80px}
#submenu ul li # three a {width: 80px}
#submenu ul li # four a {width: 90px}
#Submenu UL Li # FIVE A {Width: 80px}
# Submenu UL Li # Six A {Width: 80px}
#Submenu ul Li # seven a {width: 60px}
#submenu ul li # Eight a {width: 90px}
#submenu ul li # nine a {width: 80px}
The above code is not analyzed by one. The key to the horizontal menu is: "Float: LEFT;" statement when
http://www.wrclub.net/study/listaticicle.aspx?id=2649&page=1