2013-07-24 5 views
1

내 페이지 하단에 몇 개의 텍스트 + 몇 개의 png가있는 꼬리말이 있습니다.centering text + image CSS

나는 모든 것을 중심으로 만들려고 노력하고 있습니다. 내가 시도 할 때 margin: 0 auto 아무 일도 일어나지 않습니다. 그러나 나는 꼬리말이 아무 블럭 요소도 아니다. 그래서 그것은 의미가있다. 또한 텍스트에만있는 text-align: center을 시도했지만 여전히 아무 일도 일어나지 않습니다.

여기에 코드입니다 :

<footer> 
    <span class="contact"> Made by me - <a href="mailto:[email protected]">[email protected]</a></span> 
    <img src="http://i.imgur.com/M3RtrFw.png" alt="Twitter"> 
    <img src="http://i.imgur.com/NfLMXs9.png" alt="Google+"> 
    <img src="http://i.imgur.com/oLWJ205.jpg" alt="Facebook"> 
</footer> 

CSS : fiddle

감사 : 또한 여기

img{ 
    max-width: 100%; 
} 

img[src*="imgur"]{ 
    width: 30px; 
    height: 30px; 
    margin: 0 20px; 
} 

footer{ 
    max-width: 100%; 
    position: absolute; 
    top: 430px; 
} 


span.contact{ 
    font-family: 'Sunshiney', cursive; 
    font-size: 1.2em; 
    letter-spacing: 1px; 
    text-align: center; 
} 

이 바이올린입니다!

답변

2

또는 당신의 footer이 작업을 수행 :

footer{ 
    width: 100%; 
    text-align:center; 
    position: absolute; 
    top: 430px; 
} 

전원을 켜고 max-widthwidth에, 다음 text-align:center이 적용됩니다.
JSFiddle : http://jsfiddle.net/pS5dW/6/

+0

max-width에서 just width로 변경했을 때 작성한 것처럼 text-align으로 작업했습니다 :) max-width btw를 사용하는 것이 잘못된 이유는 무엇입니까? –

+0

@ Nilzone- 아무 문제가 없지만, 귀하의 경우에는 필요하지 않습니다. 'max-width'는 페이지 수명 시간 동안 'width'가 변경되지 않는 요소를위한 것이 아니며 항상 100 %를 유지합니다. – Cherniv

+0

max-width로 변경하기 전에 왜 텍스트가 중앙에 오지 않았습니까? 폭? –