문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 다음 판 | 이전 판 | ||
|
wiki:css:css_note:css_horizontal_navbar [2021/03/30 18:23] emblim98 만듦 |
wiki:css:css_note:css_horizontal_navbar [2023/01/13 18:44] (현재) |
||
|---|---|---|---|
| 줄 458: | 줄 458: | ||
| =====Gray Horizontal Navbar===== | =====Gray Horizontal Navbar===== | ||
| 얇은 회색 보더가 있는 회색 가로 네비게이션 바의 예제:\\ | 얇은 회색 보더가 있는 회색 가로 네비게이션 바의 예제:\\ | ||
| + | {{: | ||
| ====예제==== | ====예제==== | ||
| < | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | ul { | ||
| + | list-style-type: | ||
| + | margin: 0; | ||
| + | padding: 0; | ||
| + | overflow: hidden; | ||
| + | border: 1px solid #e7e7e7; | ||
| + | background-color: | ||
| + | } | ||
| + | li { | ||
| + | float: left; | ||
| + | } | ||
| + | li a { | ||
| + | display: block; | ||
| + | color: #666; | ||
| + | text-align: center; | ||
| + | padding: 14px 16px; | ||
| + | text-decoration: | ||
| + | } | ||
| + | li a: | ||
| + | background-color: | ||
| + | } | ||
| + | li a.active { | ||
| + | color: white; | ||
| + | background-color: | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| + | < | ||
| + | <ul> | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ul> | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | \\ | ||
| + | =====Sticky Navbar===== | ||
| + | sticky navbar를 만들려면 '' | ||
| + | sticky 요소는 스크롤 위치에 따라 relative 및 fixed 사이에서 전환됩니다.\\ | ||
| + | 주어진 오프셋 위치가 뷰포트에서 충족될 때까지, relative 배치된 다음 제자리에 " | ||
| + | ====예제==== | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | body { | ||
| + | font-size: 28px; | ||
| + | } | ||
| + | ul { | ||
| + | list-style-type: | ||
| + | margin: 0; | ||
| + | padding: 0; | ||
| + | overflow: hidden; | ||
| + | background-color: | ||
| + | position: -webkit-sticky; | ||
| + | /* Safari */ | ||
| + | position: sticky; | ||
| + | top: 0; | ||
| + | } | ||
| + | li { | ||
| + | float: left; | ||
| + | } | ||
| + | li a { | ||
| + | display: block; | ||
| + | color: white; | ||
| + | text-align: center; | ||
| + | padding: 14px 16px; | ||
| + | text-decoration: | ||
| + | } | ||
| + | li a:hover { | ||
| + | background-color: | ||
| + | } | ||
| + | .active { | ||
| + | background-color: | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| + | < | ||
| + | <div class=" | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | <ul> | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ul> | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec et. | ||
| + | Inciderint efficiantur his ad. Eum no molestiae voluptatibus.</ | ||
| + | < | ||
| + | altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec et. | ||
| + | Inciderint efficiantur his ad. Eum no molestiae voluptatibus.</ | ||
| + | < | ||
| + | altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec et. | ||
| + | Inciderint efficiantur his ad. Eum no molestiae voluptatibus.</ | ||
| + | < | ||
| + | altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec et. | ||
| + | Inciderint efficiantur his ad. Eum no molestiae voluptatibus.</ | ||
| + | < | ||
| + | altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec et. | ||
| + | Inciderint efficiantur his ad. Eum no molestiae voluptatibus.</ | ||
| + | < | ||
| + | altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec et. | ||
| + | Inciderint efficiantur his ad. Eum no molestiae voluptatibus.</ | ||
| + | < | ||
| + | altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec et. | ||
| + | Inciderint efficiantur his ad. Eum no molestiae voluptatibus.</ | ||
| + | </ | ||
| + | </ | ||
| </ | </ | ||
| + | \\ | ||
| + | **Note:** | ||
| + | Internet Explorer는 sticky positioning(고정 위치 지정)을 지원하지 않습니다.\\ | ||
| + | Safari에는 -webkit- 접두사가 필요합니다 (위의 예 참조).\\ | ||
| + | 또한 sticky positioning(고정 위치 지정)이 작동하려면 '' | ||
| + | \\ | ||
| + | =====Responsive Topnav===== | ||
| + | ====예제==== | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | body {margin: 0;} | ||
| + | ul.topnav { | ||
| + | list-style-type: | ||
| + | margin: 0; | ||
| + | padding: 0; | ||
| + | overflow: hidden; | ||
| + | background-color: | ||
| + | } | ||
| + | ul.topnav li {float: left;} | ||
| + | ul.topnav li a { | ||
| + | color: white; | ||
| + | display: block; | ||
| + | text-align: center; | ||
| + | padding: 14px 16px; | ||
| + | text-decoration: | ||
| + | } | ||
| + | |||
| + | ul.topnav li a: | ||
| + | |||
| + | ul.topnav li a.active {background-color: | ||
| + | |||
| + | ul.topnav li.right {float: right;} | ||
| + | @media screen and (max-width: 600px) { | ||
| + | ul.topnav li.right, | ||
| + | ul.topnav li {float: none;} | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| + | < | ||
| + | <ul class=" | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | <li class=" | ||
| + | </ul> | ||
| + | <div> | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | \\ | ||
| + | =====Responsive Sidenav===== | ||
| + | ====예제==== | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | body {margin: 0;} | ||
| + | ul.sidenav { | ||
| + | list-style-type: | ||
| + | margin: 0; | ||
| + | padding: 0; | ||
| + | width: 25%; | ||
| + | background-color: | ||
| + | position: fixed; | ||
| + | height: 100%; | ||
| + | overflow: auto; | ||
| + | } | ||
| + | ul.sidenav li a { | ||
| + | display: block; | ||
| + | color: #000; | ||
| + | padding: 8px 16px; | ||
| + | text-decoration: | ||
| + | } | ||
| + | ul.sidenav li a.active { | ||
| + | background-color: | ||
| + | color: white; | ||
| + | } | ||
| + | ul.sidenav li a: | ||
| + | background-color: | ||
| + | color: white; | ||
| + | } | ||
| + | div.content { | ||
| + | margin-left: | ||
| + | padding: 1px 16px; | ||
| + | height: 1000px; | ||
| + | } | ||
| + | @media screen and (max-width: 900px) { | ||
| + | ul.sidenav { | ||
| + | width: 100%; | ||
| + | height: auto; | ||
| + | position: relative; | ||
| + | } | ||
| + | ul.sidenav li a { | ||
| + | float: left; | ||
| + | padding: 15px; | ||
| + | } | ||
| + | div.content { | ||
| + | margin-left: | ||
| + | } | ||
| + | } | ||
| + | @media screen and (max-width: 400px) { | ||
| + | ul.sidenav li a { | ||
| + | text-align: center; | ||
| + | float: none; | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| + | < | ||
| + | <ul class=" | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ul> | ||
| + | <div class=" | ||
| + | < | ||
| + | < | ||
| + | <p>We have also added a media query for screens that are 400px or less, which will vertically stack and center the navigation links.</ | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | \\ | ||
| + | =====Dropdown Navbar===== | ||
| + | 네비게이션 바 내부에 드롭다운 메뉴를 추가하는 방법.\\ | ||
| + | ====예제===== | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | ul { | ||
| + | list-style-type: | ||
| + | margin: 0; | ||
| + | padding: 0; | ||
| + | overflow: hidden; | ||
| + | background-color: | ||
| + | } | ||
| + | |||
| + | li {float: left;} | ||
| + | |||
| + | li a, .dropbtn { | ||
| + | display: inline-block; | ||
| + | color: white; | ||
| + | text-align: center; | ||
| + | padding: 14px 16px; | ||
| + | text-decoration: | ||
| + | } | ||
| + | |||
| + | li a:hover, .dropdown: | ||
| + | |||
| + | li.dropdown {display: inline-block; | ||
| + | |||
| + | .dropdown-content { | ||
| + | display: none; | ||
| + | position: absolute; | ||
| + | background-color: | ||
| + | min-width: 160px; | ||
| + | box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2); | ||
| + | z-index: 1; | ||
| + | } | ||
| + | |||
| + | .dropdown-content a { | ||
| + | color: black; | ||
| + | padding: 12px 16px; | ||
| + | text-decoration: | ||
| + | display: block; | ||
| + | text-align: left; | ||
| + | } | ||
| + | |||
| + | .dropdown-content a:hover {background-color: | ||
| + | |||
| + | .dropdown: | ||
| + | </ | ||
| + | </ | ||
| + | < | ||
| + | <ul> | ||
| + | < | ||
| + | < | ||
| + | <li class=" | ||
| + | <a href=" | ||
| + | <div class=" | ||
| + | <a href="#"> | ||
| + | <a href="#"> | ||
| + | <a href="#"> | ||
| + | </ | ||
| + | </li> | ||
| + | </ul> | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| {{tag> | {{tag> | ||