How do I create CSS drop -down menus?

Cascading Style Sheets (CSS) is a name used to describe the way in which the Hyper text Markup Language (HTML) or expandable brand language (XML) is formatted. It can be used for any type of XML document, but is most often used with websites written in HTML. CSS can be used to create drop -down menus on the website. CSS drop -down menus have one text item displayed until the visitor uses the mouse to float the menu, at this point the entire list of items is displayed. The offer is created using CSS and Class identification marks. This selector looks like #. The name of the ID follows. You can name IDs, but it should be descriptive so others can read your code. For example, the drop -down menu can use the #Drop1 code.

Create a class for the first item in the CSS drop -down menu using a class selector that looks like a period. The class will be part of the HTML list element. The list element is marked with "Li" characters. Create tThe highest level of the "li.top" assignment. The class description is contained between two curly braces.

The following example shows the entire CSS code for the first item in the list:

#Drop1 li.top {font-family: Verdana, Geneva, San-serif;
Scripture-speaking: 100%;
Color: #FF00FF;}

Next, create a class for items that will be hidden under the first item in the CSS menu. The class describes a list of HTML Unsored, which is marked with the characters "UL". The description will look basically the same as the highest level menu with the addition of the words "Display: None#59" at the beginning of the description. This shows that the items in the UNSORED list will be hidden until the pointer is transmitted via the CSS drop -down menu.

The following is an example of this part of the CSS code:

#Drop1 ul.link {
Display: No#59
Font-family: Verdana, Geneva, San-Serif;
Scripture-speaking: 100%;
Color: #FF00FF;}

will beE do want the CSS drop -down menu to appear in the rest of the HMTL document. Otherwise, when the visitor floats after the offer, it pushes the rest of the document on the page and creates a list for the list. Setting the position element to the absolute, it will do it.

Position setting code is:

#Drop1 {position: Absolute;}

This is all that is needed for part of the CSS in the drop -down menu. The rest of the CSS drop -down menu is created in the HTML document using the elements "Div", "ID", "Li" and "UL". The “Div” brand separates part of the document offer. Type

Creating a part of the drop -down menu. Then start a list of disordered with HTML "UL" Element.

Add the top class to the first list and link class for the rest of the items. HTML code should look similar to:

When opening a document in a web browser, the CSS drop -down menu will appear as one item on the page. When you move the mice above the highest item, the rest of the menu will appear. The rest of the text on the page will not move, but part will be hidden by the offer.

IN OTHER LANGUAGES

Was this article helpful? Thanks for the feedback Thanks for the feedback

How can we help? How can we help?