2013-01-24 2 views
1

그때 인하로 HTML에 tranformed되는 일반 텍스트에서 생성 된 텍스트의 스타일을 시도하고 아이디어는 단락, 다음을 중심으로 사진을 (얻을 것입니다 스타일링 기사

대체 텍스트는 각주로 표시) 다음 단락.

내 페이지에서 얻는 HTML은 다음과 같습니다

:

<article class="news_item"> 
<header><a href="#">Hola</a><span><time datetime="2013-01-24" pubdate>24-01-2013</time></span></header> 
<p>Lorem ipsum dolor pscing elitr, sed diam nonumy eirmod </p> 
<p><img alt="Alt text" src="bla/bla/bla.png"/></p> 
<p>labore et dolore magna aliquyam erat, </p> 

</article> 

과 스타일은 다음과 같습니다

.news_item { 
    clear: left; 
    text-align: justify; 
    max-width:600px; 
} 

.news_item header{ 
    font-size: 16px; 
    font-weight: bold; 
} 

.news_item time{ 
    font-size: 12px; 
    position:relative; 
    float: right; 
} 


.news_item img { 
    max-width: 390px; 
    float: center; 
    position: relative; 
    clear: both; 
    margin-left:auto; 
    margin-right:auto; 
    } 

.news_item p img { 
    max-width: 390px; 
    padding: 5px; 
    float: center; 
    position: relative; 
    clear: both; 
    margin-left:auto; 
    margin-right:auto; 
    } 

.news_item p { 
    width: 600px; 
    text-align: justify; 
    } 

내가 뭘해도 상관 없어, 이미지가 중앙에되지 않습니다 조. 나는 그것이 이미지 주위에 <p></p>를 놓는 markdown과 관련이 있다고 생각하지만, 나는 이것을 어떻게 처리 할 지 모른다.

누구든지 나를 도와 줄 수 있습니까?

답변

1

스타일 사용하여 이미지 :

display:block; 
margin-left:auto; 

center 잘못된 부동 소수점 값입니다.

다음은 데모입니다. http://jsfiddle.net/JxBLq/

+0

감사합니다. 이것은 나를 미치게했다. – unaiherran