Then the CSS is designed like this:
#container
{
min-width: 600px;
width:expression(document.body.clientWidth }
The first min-width is normal; but the width in line 2 uses Javascript, which is only recognized by IE, which will also make you The HTML document is not very formal. It actually implements the minimum width through Javascript judgment.
The same method can also be used to achieve the maximum width for IE:
#container
{
min-width: 600px;
max-width: 1200px;
width:expression(document.body.clientWidth 1200? ”1200px“ : ”auto”;
}
4. IE and width and height issues IE does not recognize the definition of min-, but in fact it treats normal width and height as if there is min.This is a big problem. If you only use width and height, these two values will not change in a normal browser. If you only use min-width and min-height, the width and height are not set at all under IE.
For example, if you want to set a background image, this width is more important. To solve this problem, you can do this:
.box
{
width: 80px;
height: 35px;
}
html>body .box {
width: auto;
height: auto;
min-width: 80px;
min-height: 35px;
}
All browsers The first box setting can be used, but IE does not recognize the second paragraph setting because it uses a sub-selector command. The second setting is more specific, so it will override the first setting.
5. Font transformation command The text-transform command is very useful. It has 3 values: text-transform: uppercase, text-transform: lowercase and text -transform: capitalize. The first will change the text to all uppercase, the second to all lowercase, and the third to capitalize the first letter. This is very useful for Pinyin text. Even if there are capitalization errors when typing, they will not be visible on the web page.
6. The problem of picture text disappearing in IE Sometimes you encounter the problem of text or background image suddenly disappearing, and it reappears after refreshing. It is more likely to happen when floating elements (note: never seen it). At this point, you can set: position: relative for the disappearing elements. If that doesn't work, consider specifying a width for these elements.
7. Invisible text For whatever reason, you want some web text not to be displayed in the browser, such as for printing or for small screens. If some text is not displayed, you can use display: none. This is very simple, but sometimes it's a bit useless for some people, and they can remove this control, and then use: position: absolute; left: -9000px .
This actually specifies the text to be displayed outside the page.
8. Design special CSS for handheld devices That is, users with small screens such as mobile phones/PDAs can design a special CSS to make the web page display more comfortable. . To do this, you can adjust the browser window to 150 points wide to see the effect. The syntax for specifying handheld-specific CSS is:
Special handheld device availability can also be read.
9. Buttons with 3D effects In the past, if you wanted to create buttons with 3D effects that would change as you clicked, you had to use image replacement. , now the CSS will do:
a
{
display: block;
border: 1px solid;
border-color: #aaa #000 #000 #aaa; width: 8em;
background: #fc0;
}
a:hover
{
position: relative;
top: 1px;
left: 1px;
border-color: #000 #aaa #aaa #000;
}
As for the effect, you can also adjust it yourself.
10. Use the same navigation code on different pages Many web pages have navigation menus. When entering a certain page, this item will appear on the menu. It should turn gray and the 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 CSS classes in the navigation code:
Then specify an id for the Body of each page, which has the same name as the above class. Such as .
Then design the CSS as follows:
#home .home, #about .about, #about .about
{
commands for highlighted navigation go here
}
Here, when the id is set to home, .home will take effect, that is, the navigation bar with the class set to home will display special effects. The same goes for other pages.