๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐Ÿ‘ฉ๐Ÿป‍๐Ÿ’ปSTUDY/CSS

[CSS] ๊ฐ€์ƒ์„ ํƒ์ž๋กœ '|' ๋งŒ๋“œ๋Š” ๋ฐฉ๋ฒ•

๋ฐ˜์‘ํ˜•

๋ฉ”๋‰ด | ๋ฉ”๋‰ด | ๋ชจ์–‘์˜ ๋ฐ”๋ชจ์–‘์„ ๊ฐ€์ƒ์„ ํƒ์ž๋กœ ๋งŒ๋“œ๋Š” ๋ฐฉ๋ฒ•

<header>
  <nav>
    <h1>LOGO</h1>
    <ul>
      <li><a href="/">menu1</a></li>
      <li><a href="/">menu2</a></li>
      <li><a href="/">menu3</a></li>
      <li><a href="/">menu4</a></li>
    </ul>
  </nav>  
</header>
* { margin: 0; padding: 0; box-sizing: border-box; }
li { list-style: none; }
a { text-decoration: none; color: inherit; }

nav { width: 800px; height: 40px; margin: 0 auto; background: #e1e1e1; display: flex; }
nav h1 { align-self: center; font-size: 14px; }
nav ul { margin-left: auto; display: flex; justify-content: center; align-items: center; }
nav ul li { position: relative; margin: 0 20px; }
nav ul li::before { display: block; content: ''; position: absolute; top: 0px; bottom: 0px; right: -20px; width: 4px; background-color: #888; }
/* before์— height๋ฅผ ์ฃผ์ง€ ์•Š์•„๋„ top/bottom์— ๊ฐ’์„ ์ฃผ๋ฉด ํ˜•์„ฑ๋œ๋‹ค.  */

 

๋ฐ˜์‘ํ˜•