Implement menu bar with arrows in pure css

Source: Internet
Author: User
The following code sets the height and width of a <span> to 0 PX, and then creates a thick border. The borders in the other three directions are set to the same color as the background color, the background color of the border in the direction of the triangle is different. Note that: When designing the <span> of the display arrow, remember to design attributes such as the color of each border so that the color of the other three borders is the same as that of the background color, if no other single border is set, no effect is displayed. (Remember)

<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> untitled document </title>
<Style type = "text/css">
<! --
. D1 {
Width: 50px;
Height: 25px;
Display: block;
Text-align: center;
Display: block;
Line-height: 25px;
Text-align: left;
Font-size: 12px;
Border: 1px solid #000;
Position: relative;
Background-color: # FFF;
Text-decoration: none;
Color: # C00;
}
A: hover {
Border: 1px solid # C00;
}
A: hover span {
Width: 0px;
Height: 0px;
Display: block;
Right: 0px;
Top: 6px;
Position: absolute;
Overflow: hidden;
Background-color: # FFF;
Border-left-width: 6px;
Border-left-style: solid;
Border-left-color: # C00;
Border-top-width: 6px;
Border-bottom-width: 6px;
Border-right-width: 6px;
Border-top-style: solid;
Border-bottom-style: solid;
Border-right-style: solid;
Border-top-color: # FFF;
Border-bottom-color: # FFF;
Border-right-color: # FFF;
}

-->
</Style>
</Head>

<Body>
<A class = "d1" href = "#">
Hi!
<Span> </span>
</A>
</Body>
</Html>

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.