๊ฒฐ๊ณผ ์์
๐ ์์ฑ๋ฌผ
https://github.com/coastby/Gallery-Project
์ ๋๊ฐ์ผ๋ก ํ๋ ํ๋ฉด์ ์ค์ด๊ฑฐ๋ ํ๋ ํ์ด๋์์ ์์ด์๋ค.
text-align : center;
text-align ์์ฑ์ ๊ฐ๋ก์ ๋ ฌ์ ์ค์ ํ ์ ์๋ ์์ฑ์ด๋ค.์ฌ๊ธฐ์๋, ๊ฐ์ด๋ฐ ์ ๋ ฌ์ ํ๊ธฐ ์ํด ์์ฑ๊ฐ์ 'center'๋ก ์ค์ ํ๋ค.
justify-content : center;
display ์์ฑ์ด flex๋ก ์ค์ ๋์ด ์์ผ๋ฉด,text-align ์์ฑ์ ์ง์ ํด๋ ๊ฐ์ด๋ฐ ์ ๋ ฌ์ด ๋์ง ์๋๋ค.์ด ๋๋, ์ ์์ ์ ๊ฐ์ดjustify-content ์์ฑ์ ์ค์ ํด ์ฃผ์ด์ผ ํ๋ค.
padding : 100px 0;
์ฌ๊ธฐ์๋ div์ padding์ ์ง์ ํ์ฌ,๋ฌธ์์ด์ div์ ๊ฐ์ด๋ฐ(์ธ๋ก)์ ์ค๋๋ก ํ๋ค.padding ์์ฑ์ 2๊ฐ์ ๊ฐ์ด ์
๋ ฅ๋์๋๋ฐ,์ฒซ๋ฒ์งธ ๊ฐ์ ์, ์๋์ padding์ ์ค์ ํ๋ค.๋๋ฒ์งธ ๊ฐ์ ์ผ์ชฝ, ์ค๋ฅธ์ชฝ์ padding์ ์ค์ ํ๋ค.
line-height : 200px;
์ฌ๊ธฐ์๋ line-height์ ๊ฐ์ div์ height ๊ฐ๊ณผ ๋๊ฐ์ด ์ง์ ํ์ฌ ๋ฌธ์์ด์ ๊ฐ์ด๋ฐ(์ธ๋ก) ์ ๋ ฌํ์๋ค.
align-items : center;
๊ฐ๋ก ์ ๋ ฌ๊ณผ ๋ง์ฐฌ๊ฐ์ง๋กdisplay ์์ฑ์ด flex๋ก ์ง์ ๋๋ฉด,์์์ ์๊ฐํ ๋ฐฉ๋ฒ์ผ๋ก๋ ์ธ๋ก ์ ๋ ฌ์ด ์ด๋ ต๋ค.๋ฐ๋ผ์, ์ด ๋๋ ์ ์์ ์ฒ๋ผalign-items ์์ฑ์ center๋ก ์ง์ ํ์ฌ ์ธ๋ก ๊ฐ์ด๋ฐ ์ ๋ ฌ์ ํด์ผํ๋ค.
.child {
display : inline-block;
margin-top : 50px;
}
.parent {
display: flex;
align-items: center;
}
#login-form a {
text-align: center;
text-decoration: none; /* ๋งํฌ์ ๋ฐ์ค ์ ๊ฑฐ */
color: inherit; /* ๋งํฌ์ ์์ ์ ๊ฑฐ */
}
์ถ์ฒ: https://hyunjungchoi.tistory.com/44 [ํ๋ฝ๐ฅ:ํฐ์คํ ๋ฆฌ]
.menu-wrap { width:1200px; margin:0 auto; }
.menu { float:left; text-align:center; }
.menu li { display:inline-block; text-align:center; }
div { overflow:hidden; }
div p{ float:left; }
์ ์ฉ
<header id="toolbar">
<div id="home-logo" onclick="location.reload();">
Gallery Portfolio
</div>
<nav>
<ul>
<li class="gallery on" onclick="setNew('gallery')">์ฌ์ง๋ค ๋ณด๊ธฐ</li>
<li class="upload" onclick="setNew('upload')">์ฌ์ง ์ฌ๋ฆฌ๊ธฐ</li>
<li class="myinfo" onclick="setNew('myinfo')">๋ด ์ ๋ณด</li>
<li>ํ๋ก์ฐ ๋ณด๊ธฐ</li>
<li>ํ๋ก์ ๋ณด๊ธฐ</li>
</ul>
</nav>
<a href="#">
<div class="sign">Logout</div>
</a>
</header>
nav ul{
overflow: hidden;
height: 50px;
padding-left: 30px;
}
nav li {
float: left;
width: 100px;
text-align: center;
font-size: 1rem;
font-weight: 600;
}
์๋์์ ๋์ค๊ฒ ์ง๋ง header์๋ grid ์ ์ฉ์ด ์๋์ด์ 'toolbar'๋ผ๋ ์์ด๋๋ฅผ ์ฃผ๊ณ css ์ ํ์๋ก ์ฌ์ฉํ์๋ค.
#toolbar {
display: grid;
grid-template-columns: 350px 1fr 70px;
position: fixed;
top: 0;
left: 0;
right: 0;
background-color: #2962FF;
color: #EEEEEE;
height: 50px;
line-height: 50px;
width: 100%;
box-shadow: 2px 0 5px #0D47A1 ;
z-index: 2;
}
header {
position : fixed;
top : 0;
left : 0;
right : o;
z-index : 2;
}
.sidebar {
position : fixed;
width : 160px;
z-index : 1;
}
main {
/*header : 50px, footer : 60px, sidebar : 160px*/
min-height : calc(100vh - 110px);
margin-left : 160px;
padding-bottom : 60px;
}
footer {
position : absolute;
bottom : 0;
left: 0;
width : 100%;
height : 60px;
z-index : 2;
}
https://d2.naver.com/helloworld/8540176
https://studiomeal.com/archives/197
img {
object-fit : cover;
}
.word {
/*
margin:100px;
outline: 1px solid black;
display: block;
color: black;
width: 630px;
font-size: 20px;
font-weight: bolder !important;
*/
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
<div style="align-items:center; display: flex; justify-content:center;">
/* footer ํ๋จ ๊ณ ์ [S] */
html, body {
margin: 0;
padding: 0;
height: 100%;
}
#body-wrapper {
min-height: 100%;
position: relative;
}
#body-content {
margin-top: 100px;
padding-bottom: 99999px; /* footer์ ๋์ด */
}
footer {
width: 100%;
height: 99999px; /* footer์ ๋์ด */
position: absolute;
bottom: 0;
left: 0;
}
/* footer ํ๋จ ๊ณ ์ [E] */
css selector๋ก header๋ฅผ ํ๋ฉด ๋ค๋ฅธ ์คํ์ผ์ ์ ์ฉ์ด ๋๋๋ฐ, gird ๊ด๋ จ๋ ๊ฒ์ ์ ์ฉ์ด ์ ๋๋ ๋ฏํ๋ค. display : grid๋ฅผ ์ ์ฉํ ๋๋ ์ ํ์๊ฐ id ๋๋ class ์ฌ์ผํ๋์ง ์ฐพ์๋ดค๋๋ฐ ๋ ํผ๋ฐ์ค๋ฅผ ์ฐพ์ง ๋ชปํ๋ค.