ArticleDirectory
- Original code:
- Improved code:
Recently, according to the sliding doors of CSS and Part II of a list apart, Stu Nichols This article revised the sliding door menu and published the 100% clickable sliding doors Makes up for the blind spots of 9 pixels.
Click the blind area icon. It is obvious that there is no hand icon on the edge of the above menu.
Original Code :
# Nav Li {
Float: left;
Background: URL ("left_both.gif") No-repeat left top;
Margin: 0;
Padding: 0 0 0 9px;
Border-bottom: 1px solid #765;
}
# Nav {
Float: left;
Display: block;
Background: URL ("right_both.gif") No-repeat right top;
Padding: 5px 15px 4px 6px;
Text-Decoration: none;
Font-weight: bold;
Color: #765;
}
Improved code:
# Nav Li {
Float: left;
Background: URL ("right_both.gif") No-repeat right top;
Margin: 0 0 0 9px;
Padding: 0;
}
# Nav {
Float: left;
Display: block;
Position: relative;
Left:-9px;
Margin-Right:-9px;
Width:. 1em;
Background: URL ("left_both.gif") No-repeat left top;
Padding: 5px 20px;
Text-Decoration: none;
Font-weight: bold;
Color: #765;
}
By comparing the above code, we can see that the left and right background images are switched and the relative positioning is adopted. The list project and its link use the positive and negative boundary method. The author has ie5.x, IE6, IE7, firefox and opera are successfully debugged.
On the demo page, I simplified the code for the current location and switched to class selectors.