2013-01-25 3 views
0

나는 해결하기가 어렵다고 생각하는 CSS/html에 문제가 있습니다. 이 코드는 다음과 같습니다하단에 텍스트 정렬

Images with lines of one line and two lines

아래처럼 보이는이 같은 그 안에 우리가 링크와 H2가 있다고 가정하자 :
<a href="newLink"><h2>This can be one line or two lines or three..</h2></a> 

나는 선이 아래 바닥을 정렬해야합니다 ... 또한 텍스트는 하단뿐만 아니라 가운데에 배치됩니다. 이 작업을 수행하는 방법?

        Andis AGC Clipper Single 
Andis AGC 2 Speed Clipper      Speed 

답변

1

HTML

<div> 
<h2>one line</h2> 
    <h2 align=center>This can be one line or two lines or three..</h2> 
</div> 

CSS

div{background:grey; width:100%} 
h2{ 
    font-size:20px; 
    color:white; width:49%; 
    display:inline-block 
} 

중앙 정렬에 대한 Sowmya 데모를 편집.

+0

나는 수직 정렬을 사용하여 그것을 해결했다 : 바닥; display : table-cell 아직 모든 브라우저를 사용하여 테스트하지 않았습니다. –

+0

이제 ans를 수락해야합니다. 그 문제를 표시하기 위해 해결되었습니다. – Arpit

2

HTML

<div> 
<h2>one line</h2> 
    <h2>This can be one line or two lines or three..</h2> 
</div> 

CSS

div{background:grey; width:100%} 
h2{ 
    font-size:20px; 
    color:white; width:49%; 
    background:red; 
    display:inline-block; 
    text-align:center 
} 

DEMO

관련 문제