๐Ÿ“’ [ TIL ] 2022.04.28_9์ผ์ฐจ # ์ธ์Šคํƒ€UIํด๋ก (1)

๋ฌธ๋ช…์ฃผยท2022๋…„ 4์›” 28์ผ
0
post-thumbnail

[ 2022-04-28 (๋ชฉ) ์˜ค๋Š˜์˜ TIL ]

[ Today Project ]

  • ์ธ์Šคํƒ€ UIํด๋ก  ํ”„๋ก ํŠธ๊ฐœ๋ฐœ
    : ์ด๋ฒˆ ํ”„๋กœ์ ํŠธ๋Š” ๊ฐœ์ธํ”„๋กœ์ ํŠธ๋กœ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.

[ Today Learn ]

  • ์ƒ๋‹จ navbar ๋ฐ ์˜ค๋ฅธ์ชฝ ํ”„๋กœํ•„๊ฒŒ์‹œ๋ถ€๋ถ„ ๊ณ ์ •
  • ๋ฏธ๋””์–ด์ฟผ๋ฆฌ ์ ์šฉ

โœ๏ธ ๋‚ด๊ฐ€ ๋ฐฐ์šด๊ฒƒ, ์–ป์€๊ฒƒ

  • ์ƒ๋‹จ navbar ๋ฐ ์˜ค๋ฅธ์ชฝ ํ”„๋กœํ•„๊ฒŒ์‹œ๋ถ€๋ถ„ position: fixed ์†์„ฑ์œผ๋กœ ๊ณ ์ •ํ•˜์—ฌ ์Šคํฌ๋กค์„ ์›€์ง์—ฌ๋„ ๊ณ ์ •๋˜์–ด ์›€์ง์ด์ง€์•Š๊ฒŒ ์„ค์ •

๐Ÿงฉ ์ ์šฉ์˜ˆ์‹œ

<!-- ๋„ค๋น„๊ฒŒ์ด์…˜๋ฐ” ์‹œ์ž‘-->
<nav class="navbar navbar-expand-lg navbar-light bg-light" style="width: 100%; height: 60px; position: fixed">
    <div class="container-fluid">
        <div class="main-menu">
            <img class="main-img" style="object-fit: contain; cursor:pointer"
                 src="https://www.instagram.com/static/images/web/mobile_nav_type_logo.png/735145cfe0a4.png"
                 onclick="window.location.reload()">
            <input class="form-control me-2" style="width: 265px; height: 35px; background-color: #f0f0f2  "
                   type="search" placeholder="๊ฒ€์ƒ‰" aria-label="Search">
            <div class="icon"> // ์ƒ๋‹จ ์•„์ด์ฝ˜๋“ค
                <span class="material material-symbols-outlined">home</span>
                <span class="material material-symbols-outlined">near_me</span>
                <span class="material material-icons-outlined">add_box</span>
                <span class="material material-icons-outlined">explore</span>
                <span class="material material-icons-outlined">favorite_border</span>
            </div>
        </div>
    </div>
</nav>
<!-- ๋„ค๋น„๊ฒŒ์ด์…˜๋ฐ” ๋-->

  • ๋ฏธ๋””์–ด์ฟผ๋ฆฌ๋ฅผ ์ ์šฉํ•˜์—ฌ ๋ชจ๋ฐ”์ผ๋ฒ„์ „ ๊ณ ๋ คํ•˜์—ฌ ํ™”๋ฉด์ •๋ ฌ

๐Ÿงฉ ์ ์šฉ์˜ˆ์‹œ

    /*๋ฏธ๋””์–ด์ฟผ๋ฆฌ ์„ค์ •*/
    @media screen and (max-width: 1000px) {
        .right-body {
            display: none;
        }

        .form-control {
            display: none;
        }

        .left-body {
            margin-left: 360px;
        }
    }

๋„“์ด๊ฐ€ 1000px ๋ณด๋‹ค ์ž‘์•„์กŒ์„๋•Œ ์•„๋ž˜์™€ ๊ฐ™์ด navbar์˜ ๊ฒ€์ƒ‰์ฐฝ๊ณผ ์˜ค๋ฅธ์ชฝ ํ”„๋กœํ•„์ •๋ ฌ๋œ๋ถ€๋ถ„์ด ์‚ฌ๋ผ์ง€๊ฒŒ ํ–ˆ๊ณ , ์™ผ์ชฝ์˜ ํ”ผ๋“œ๊ฒŒ์‹œ๋ถ€๋ถ„์ด ๊ฐ€์šด๋ฐ๋กœ ์ •๋ ฌ๋  ์ˆ˜ ์žˆ๊ฒŒ ์ ์šฉํ–ˆ๋‹ค.

๐ŸŒฑ ๋Š๋‚€ ์ 

ํ”„๋ก ํŠธ๋ถ€๋ถ„์„ ๊ฐœ๋ฐœํ•˜๋ฉด์„œ ์ฝ”๋“œ๋ฅผ ๊ฐ€๋…์„ฑ์ด ์ข‹๊ฒŒ ์งœ๋Š”๊ฒƒ์ด ํž˜๋“ค๋‹ค๋Š” ๊ฒƒ์„ ์•Œ์•˜๋‹ค.
class๋ช…๋„ ์–ด๋–ค ๋ถ€๋ถ„์„ ๊ณ ๋ คํ•˜์—ฌ ๋งŒ๋“ค์–ด์•ผํ•˜๋Š”์ง€ ์•„์ง ๊ฐ์ด ์žกํžˆ์ง€ ์•Š๋Š”๋‹ค.
์•ž์œผ๋กœ ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ• ๋•Œ๋Š” ๋ฆฌํŒฉํ† ๋ง๋„ ์‹œ๋„ํ•˜๋ฉด์„œ ์ฝ”๋“œ๋ฅผ ๊ฐ€๋…์„ฑ์ด ์ข‹๊ฒŒ ์งœ๋ณด๋Š” ์—ฐ์Šต์„ ํ•ด๋ด์•ผ ํ• ๊ฒƒ๊ฐ™๋‹ค.
๋ฒจ๋กœ๊ทธ๋ฅผ ์“ฐ๋ฉด์„œ ๋Š๋ผ๋Š” ์ ์ด ํ•œ๊ฐ€์ง€ ์žˆ๋Š”๋ฐ, ํ•˜๋ฃจํ•˜๋ฃจ๊ฐ€ ์ง€๋‚ ๋•Œ๋งˆ๋‹ค ๋ฐฐ์šฐ๊ฒŒ ๋˜๋Š” ์ ์ด ์ตœ์†Œ ํ•œ๊ฐ€์ง€์”ฉ์ด๋ผ๋„ ๋Š˜๊ฒŒ ๋œ๋‹ค๋Š” ๊ฒƒ์ด๋‹ค. ๊ทธ๋ž˜์„œ ๋‚ด๊ฐ€ ํ•˜๋ฃจํ•˜๋ฃจ ๊ฐˆ์ˆ˜๋ก ๋ฐœ์ „ํ•ด๋‚˜๊ฐ„๋‹ค๋Š”๊ฒŒ ์™€๋‹ฟ๋Š”๋‹ค. ๐Ÿ˜

๐ŸŽ ์ž์„ธํ•œ ์ฝ”๋“œ๋Š” Moonmoo ์— ๊ฒŒ์‹œํ–ˆ์Šต๋‹ˆ๋‹ค

profile
ํ•˜๋ฃจ ํ•œ๊ฑธ์Œ์”ฉ ๊พธ์ค€ํžˆ ๋‚˜์•„๊ฐ€๋Š” ๊ฐœ๋ฐœ์ž๐Ÿ™†โ€โ™€๏ธ https://github.com/Moonmooj

2๊ฐœ์˜ ๋Œ“๊ธ€

comment-user-thumbnail
2022๋…„ 4์›” 29์ผ

๋ช…์ฃผ๋‹˜ ์•ˆ๋…•ํ•˜์„ธ์š”~! ์ž˜ ๋ณด๊ณ  ๊ฐ‘๋‹ˆ๋‹ค :) ๊ฐ™์ด ํ•œ๊ฑธ์Œ ๋‘๊ฑธ์Œ ๊ฑธ์–ด๋ด…์‹œ๋‹ค ใ…Žใ…Žใ…Ž ํ•ญ์ƒ ํŒŒ์ดํŒ…์ด์—์š”! ์•„์ž์•„์ž!!!
์ฃผ๋ง ์ž˜ ๋ณด๋‚ด์‹ญ์‡ผ~!

1๊ฐœ์˜ ๋‹ต๊ธ€

๊ด€๋ จ ์ฑ„์šฉ ์ •๋ณด