The menu navigation of the CSS technology combining with the image to realize the dynamic effect

Source: Internet
Author: User
Tags implement
css| Menu | navigation | news

  The menu navigation of the CSS technology combining with the image to realize the dynamic effect

This article describes some of the things we often use but rarely pay attention to, in the following description we assume that your CSS is using @import technology, because CSS here may make you lose faith in Opera 4. If you take the image as part of your page layout, embedding the image under the control of the CSS is probably the result you don't want if you are using a browser that does not support CSS2 standards such as Opera 4. Here's an example of using some GIF images to decorate rounded corners.

In fact, I don't want to embed images in the HTML code of a Web page because they represent only visual things, not content, so I control them and some other representative parts under CSS. This method will make it easier for you to control the page and make it more beautiful. To make the wrapping work, I took advantage of the CSS background image: The purpose of using these background images is to better fit the layout of the CSS, and we embed these images in the background of the layer.

Here you can see how I define the size of the picture (19PX*37PX) and have the corresponding background image at the end of each picture. The two pictures are then placed inside a predetermined linear object. Of course, many of these principles can be reused, so your final CSS code does not need to be very large. The only disadvantage of this method is that it cannot be used to adjust the size of the dynamic picture, if your layer is smaller than the image, it will be ignored, if your layer is larger than the image, it will be repeatedly filled in the blank area. But it is quite possible that you do not want the image to be detected anywhere in the operation.

CSS Dynamic Image Technology

Give the CSS Text menu dynamic technology, such as the left menu of the Web page, which is now being enjoyed by more and more people. But I don't think I've ever seen this technique: a technique that simply uses CSS to achieve this effect. It allows the menu to have image conversion function, the problem here is that we use pure CSS to achieve this effect. The following two steps are used to implement the menu image transformation technology in the afterlife. The first step is only to change the background color, the second step is to accurately rotate the multidimensional image. (Warning: The disadvantage of this technique is that some of these technologies cannot be used with opera 61, although they are a good technique in Opera 7.) )

Transform background image 1

If this is a transparent background image, then we can make it very easy to use the selector to change the color behind it. In this example, the image is embedded in the HTML resource, which means it will also appear in browsers that do not support the CSS2 standard (except for the text browser!). The code would be more complex than the following example, but it would work in all the browsers I tried. Note that only one image can be downloaded at a time in the process of implementing the effect.

Transform background Image 2

This version is very simple relative to version 1. The image is a CSS background image and is not displayed in browsers that do not support CSS2 standards: But we provide an alternative text link, which is an example of being eliminated.

Rotate Button 1

Now, the first method is to use the background image, using the A:hover feature, to change the background image when the pointer points to the image, so the image will not be displayed if the CSS is turned off. At the same time, we can get the optional text link. This method supports Ie6,netscape 7, Mozilla and Opera 7, but does not support Opera 6. The third type of button state can be passed to the image by a similar method: Active selector. Readers can think of this method as a practice.

Rotate Button 1a

This is different from button 1. We use a CSS background image again, but if we use a rotation selection to load a new image to the other state of the button, we use CSS to change the position of the existing image. Use this if the image is too large, The background image is trimmed. So our buttons are separate images that contain two button states. The upper half of the image is usually displayed, but when the button is rotated the image is replaced with the lower half. So this is the complete image. There are two advantages to using this method. If you are accessing the button to reduce the number of downloads-download only one image for two-so this is faster. Second, there is no delay in waiting for the second image to be downloaded on the first visit: it's already here. No need to preload complex images. The downside is that if the button is not accessed, some bit bandwidth is wasted, as is the idea of using the button 1,html and CSS. The main difference in: Rotary selection.

Closing button 2

As follows, another way to implement CSS rotation image is to use the Z-index feature of the image, and Z index control shows which element is at the top level. Unfortunately, it does not support IE6 or Opera 6.Opera 7, Mozilla and Netscape 7 can work, However, in this case Mozilla is so slow, the CSS2 browser rotation does not work, only the top layer of the image display normal. The top and rotated images in a non-CSS2 browser appear to be odd. Internet Explorer's workspace contains a small handler, and if the image background color changes, the z index changes, and Internet Explorer gets the change to do the work. Philip changed colors by changing the values of the three primary colors (for example, changing the #ffffff to # Fffffe) The effect of such a small change is significant.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.