#10 CSS3 Flexbox: nav style setting

What is nav?

  • nav = navagator
  • “The <nav> HTML element represents a section of a page whose purpose is to provide navigation links, either within the current document or to other documents. Common examples of navigation sections are menus, tables of contents, and indexes.” by Mozilla
    https://ithelp.ithome.com.tw/upload/images/20210909/20130362zZETpK3rmO.png
    Resource: https://pixabay.com/

Final Design

https://ithelp.ithome.com.tw/upload/images/20210909/201303628S1IPQvlih.png
https://ithelp.ithome.com.tw/upload/images/20210909/20130362l3qqWOPFGu.png


Horizontal alignment with Flex

Before
https://ithelp.ithome.com.tw/upload/images/20210909/20130362QoHsrHGlsN.png

nav{}
 
nav>.logo{
    background-color:#ffcccc;
}
nav>.menu{
    background-color:#ccccff;
}
nav>.user{
    background-color:#ccffcc;
}

After
https://ithelp.ithome.com.tw/upload/images/20210909/201303624OZ4lyyinF.png

nav{
    display: flex;
}
 
nav>.logo{
    flex:none;width:100px;
    background-color:#ffcccc;
}
nav>.menu{
    flex:none;
    background-color:#ccccff;
}
nav>.user{
    flex:none;width:100px;
    background-color:#ccffcc;
}

If you want the menu to extend automatically, replace the “none" of menu with “auto.” The length of menu will adapt to the web page while we change its pixel.
https://ithelp.ithome.com.tw/upload/images/20210909/201303623QdTQTfS2M.png


Music of Today: Thunder by Imagine Dragons


Like/Share/Follow

Feel free to comment and share your ideas below to learn together!
If you guys find this article helpful, please kindly do the writer a favor — LIKE this article./images/emoticon/emoticon12.gif


<<:  每个人都该学的30个Python技巧|技巧 10:回圈二部曲—for回圈(字幕、衬乐、练习)

>>:  [Day7] Android - Kotlin笔记:JetPack - KTX简介

Python 练习

今天我们一样要来做练习,那我们就开始吧。 题目 让使用者输入一整数,求此整数以下(包含此数)的质数和...

D9. 学习基础C、C++语言

D9: while跟 do-while的差别 我原本一直以为do-while是要判断式成立时才会执行...

# Day1 简介

Linux 是一个泛用型的作业系统,在各式各样、形形色色的机器上都找的到他的踪迹, 而 Linux...

Day 29 : 撰写LineBot,利用短短三天认识自动化机器人(下)

今天来继续接着昨天的LineBot。我们昨天讲到,我们可以使用ngrok来让程序连上公开网路,也就是...

#8 NumPy教学

NumPy操作 安装 请在终端机底下输入这个,谢谢 pip install numpy 载入NumP...