2016-11-30 1 views
-3

내 로고가 네 개의 이미지 가운데에 오게하고 싶습니다. 어떻게해야합니까? 4 개의 이미지가 창을 채우고 로고가 가운데에 배치되기를 바랍니다. 또한 이미지를 스트레칭하고 싶지 않지만 필요센터 로고 및 4 개의 이미지를 페이지에 채우시겠습니까?

.header { 
 
    background-color: black; 
 
    border-bottom: 1px solid #466995; 
 
    overflow-y: auto; 
 
    position: fixed; 
 
    top: 0; 
 
    left: 0; 
 
    width: 100%; 
 
    z-index: 10; 
 
} 
 

 
ul { 
 
    margin: 30px auto; 
 
    text-align: center; 
 
} 
 

 
li { 
 
    color: #FFF; 
 
    display: inline-block; 
 
    font-family: 'Oswald', sans-serif; 
 
    font-size: 16px; 
 
    text-align: left; 
 
    font-weight: 300; 
 
    text-transform: uppercase; 
 
    padding: 0 100px; 
 
} 
 

 
li:hover { 
 
    color: #DBE9EE; 
 
} 
 

 

 
body { 
 
    margin: 0; 
 

 
} 
 

 
img { 
 
    max-width: 100%; 
 
    height: auto; 
 
} 
 

 
#container { 
 
    max-width: 100%; 
 
    z-index: -100; 
 
    margin: 0; 
 
    padding: 0; 
 
} 
 

 
.containermenu { 
 

 
} 
 

 
.containermenu img{ 
 
    width: 50%; 
 
    height: 50%; 
 
    float: left; 
 
} 
 

 
#logo { 
 
    width: 20%; 
 
    margin: 0 auto; 
 
    position: absolute; 
 
    z-index: 20; 
 
    left: 40%; 
 
    right: 40%; 
 

 

 

 
} 
 

 
#process img { 
 
    width: 100%; 
 
} 
 

 
#process { 
 
    width: 100%; 
 
}
<div id="container"> 
 
    <div id="logo"><a href="index.html"><img src="http://oi68.tinypic.com/2njh9id.jpg"></a></div> 
 
    <div class="containermenu"><a href="packaging.html"><img src="http://oi67.tinypic.com/vgmv80.jpg"></a></div> 
 
    <div class="containermenu"><a href="photography.html"><img src="http://oi67.tinypic.com/vgmv80.jpg"></a></div> 
 
    <div class="containermenu"><a href="illustration.html"><img src="http://oi67.tinypic.com/vgmv80.jpg"></a></div> 
 
    <div class="containermenu"><a href="about.html"><img src="http://oi67.tinypic.com/vgmv80.jpg"></a></div> 
 
</div>

Codepen link

+1

CSS를 More infor here에 중앙에. "어떤 아이디어 야?" 그 질문에 대해 누구에게도 말하지 않습니다. –

+0

@JuanMendes 죄송합니다. 제목이 변경되었습니다. – Dunne08

+0

본문을 편집하십시오. –

답변

0

될 경우 다음과 같은 CSS를 사용하여 페이지에 완벽하게 항목을 중심에 크기를 조정 고려할 것

position: absolute; 
left: 50%; 
top: 50%; 
transform: translateX(-50%) translateY(-50%); 

편집 : Updated Codepen

+0

고마워요. 네 개의 이미지 가운데에 로고를 붙일 수있는 방법이 있습니까? – Dunne08

+0

내 링크를 다시 확인하십시오. 나는 위치를 추가했습니다 : #container에게 절대적으로 그것도 중심에 두도록했습니다. –

+0

다른 사람들을 돕기 위해 선택된 대답으로 upvote와 mark로 자유롭게 느껴보십시오 :) –

0

사용 transform 의미있는 질문 헤더를 만드십시오

.header { 
 
    background-color: black; 
 
    border-bottom: 1px solid #466995; 
 
    overflow-y: auto; 
 
    position: fixed; 
 
    top: 0; 
 
    left: 0; 
 
    width: 100%; 
 
    z-index: 10; 
 
} 
 
ul { 
 
    margin: 30px auto; 
 
    text-align: center; 
 
} 
 
li { 
 
    color: #FFF; 
 
    display: inline-block; 
 
    font-family: 'Oswald', sans-serif; 
 
    font-size: 16px; 
 
    text-align: left; 
 
    font-weight: 300; 
 
    text-transform: uppercase; 
 
    padding: 0 100px; 
 
} 
 
li:hover { 
 
    color: #DBE9EE; 
 
} 
 
body { 
 
    margin: 0; 
 
} 
 
img { 
 
    max-width: 100%; 
 
    height: auto; 
 
} 
 
#container { 
 
    max-width: 100%; 
 
    z-index: -100; 
 
    margin: 0; 
 
    padding: 0; 
 
} 
 
.containermenu {} .containermenu img { 
 
    width: 50%; 
 
    height: 50%; 
 
    float: left; 
 
} 
 
#logo { 
 
    width: 20%; 
 
    position: absolute; /*fixed*/ 
 
    top: 50%; 
 
    left: 50%; 
 
    transform: translate(-50%, -50%); 
 
} 
 
#process img { 
 
    width: 100%; 
 
} 
 
#process { 
 
    width: 100%; 
 
}
<div id="container"> 
 
    <div id="logo"> 
 
    <a href="index.html"> 
 
     <img src="http://oi68.tinypic.com/2njh9id.jpg"> 
 
    </a> 
 
    </div> 
 
    <div class="containermenu"> 
 
    <a href="packaging.html"> 
 
     <img src="http://oi67.tinypic.com/vgmv80.jpg"> 
 
    </a> 
 
    </div> 
 
    <div class="containermenu"> 
 
    <a href="photography.html"> 
 
     <img src="http://oi67.tinypic.com/vgmv80.jpg"> 
 
    </a> 
 
    </div> 
 
    <div class="containermenu"> 
 
    <a href="illustration.html"> 
 
     <img src="http://oi67.tinypic.com/vgmv80.jpg"> 
 
    </a> 
 
    </div> 
 
    <div class="containermenu"> 
 
    <a href="about.html"> 
 
     <img src="http://oi67.tinypic.com/vgmv80.jpg"> 
 
    </a> 
 
    </div> 
 
</div>

관련 문제