Flexbox responsive menu

Source: Internet
Author: User

I have been studying flexbox these two days to see a responsive menu implemented by Flexbox.

You can go to codepen to play online or download the effect of adding to favorites. Remember to use different window widths to test the responsive layout.

Okay. The html file is very simple. It is a normal menu.

<ul class="navigation">  <li><a href="#">Home</a></li>  <li><a href="#">About</a></li>  <li><a href="#">Products</a></li>  <li><a href="#">Contact</a></li></ul>
Css file

.navigation {  list-style: none;  margin: 0;     background: deepskyblue;  border-bottom: 2px solid hotpink;  box-shadow: 0 0 5px rgba(0,0,0,1);    display: -webkit-box;  display: -moz-box;  display: -ms-flexbox;  display: -webkit-flex;  display: flex;    -webkit-flex-flow: row wrap;  justify-content: flex-end;}.navigation a {  color: #333;  text-decoration: none;  display: block;  padding: 15px;  color: white;  font-weight: bold;}.navigation a:hover {  background: darken(deepskyblue, 2%);}@media all and (max-width: 800px) {  .navigation {    justify-content: space-around;  }}@media all and (max-width: 600px) {  .navigation {    -webkit-flex-flow: column wrap;    padding: 0;  }    .navigation a {     text-align: center;     padding: 10px;    border-top: 1px solid rgba(255,255,255,0.3);     border-bottom: 1px solid rgba(0,0,0,0.1);   }  .navigation li:last-of-type a {    border-bottom: none;  }}
Okay, it's done. ---------------------------------------------------------------

Front-end development of whqet, focus on web Front-end development technology, and share webpage-related resources.
---------------------------------------------------------------

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.