We still need to remember some classic CSS techniques, which can save us a lot of time. Below, I will recommend a few better CSS techniques for you:
1. Use the same navigation code on different pages
Many web pages have navigation menus. When entering a certain page, the corresponding item on the menu should turn gray, while other pages should light up. . Generally, to achieve this effect, you need to write a program or design specifically for each page. Now you can achieve this effect with CSS.
First, use the CSS class in the navigation code:
<ul> <li><a href="#" class="home">首页</a></li> <li><a href="#" class="about">关于我们</a></li> <li><a href="#" class="contact">联系我们</a></li> </ul>
Then specify the Body for each page separately An id with the same name as the above class. Such as
.Then design the CSS as follows:
#home .home, #about .about, #contact .contact { commands for highlighted navigation go here }
2. Comparison of Block and inline elements
All HTML elements belong to one of block and inline. The characteristics of the block element are: always starts on a new line; Height, line height and top and bottom margins can all be controlled; The default width is 100% of its container unless a width is set,
,