2014-01-10 1 views
1

단락 텍스트 내에서 이미지를 플로팅하는 것이 가장 좋은 방법입니까? 나는 텍스트의 단락의 상단이 이미지의 상단에 정렬되도록하고 이미지 주위에 패딩을 넣어 텍스트가 아닌지 확인하고자합니다. 내 http://jsfiddle.net/huskydawgs/vrLeg/단락의 이미지 플로팅 모범 사례

<div style="float:right;padding:0 0 20px 30px"> 
    <img alt="Request White Paper" src="http://icons.iconarchive.com/icons/artbees/paradise-fruits/256/Pear-icon.png" /> 
</div> 
<p><strong>Authors: </strong>Don Bankes and Jennifer Blakc<br /> 
    <strong>Publication Date: </strong>January 2014</p> 

<p>The pear is any of several tree and shrub species of genus Pyrus /ˈpaɪrəs/, in the family Rosaceae. It is also the name of the pomaceous fruit of these trees. Several species of pear are valued for their edible fruit, while others are cultivated as ornamental trees. The genus Pyrus is classified in subtribe Pyrinae within tribe Pyreae.</p> 
<p>The genus is thought to have originated in present-day western China in the foothills of the Tian Shan, a mountain range of Central Asia, and to have spread to the north and south along mountain chains, evolving into a diverse group of over 20 widely recognized primary species[citation needed]. The enormous number of varieties of the cultivated European pear (Pyrus communis subsp. communis), are without doubt derived from one or two wild subspecies (P. communis subsp. pyraster and P. communis subsp. caucasica), widely distributed throughout Europe, and sometimes forming part of the natural vegetation of the forests. Court accounts of Henry III of England record pears shipped from La Rochelle-Normande and presented to the King by the Sheriffs of the City of London. The French names of pears grown in English medieval gardens suggest that their reputation, at the least, was French; a favored variety in the accounts was named for Saint Rule or Regul', Bishop of Senli</p> 
+0

당신이 가장 좋은 방법은 아니라고 생각하는 몇 가지 이유가 있습니까? –

+0

이것은 실제로 의견의 문제입니다. 예를 들어, 나는 이것을 http://jsfiddle.net/j08691/vrLeg/1/과 같이 할 것입니다. 추가 된 div를 제거하고 이미지를 텍스트와 그룹화합니다. 같은 결과. – j08691

답변

0

"최고"가장 좋은 방법은

체크 아웃은 HTML 문서에서 부동 명시된 표준을 따르는 것입니다 :

즉, this wiki on floatsthese specs, 모두 w3c에서.

항상 그렇듯이 개발자의 두통을 피하기 위해 플로트를 지워야합니다.

1

스타일 시트에 이미지 플로트 클래스를 만든 다음 왼쪽 또는 오른쪽으로 플로팅하려는 이미지에 클래스를 적용합니다.

텍스트 단락을 원하는대로 정렬하려면 해당 항목을 왼쪽 또는 오른쪽으로 유동시키고 저자/발행일 이전이 아닌 텍스트 단락 앞에 이미지 html을 가져와야합니다.

CSS :

.alignright { 
    float: right; 
    margin: 0px 0px 20px 30px; 
    } 

HTML :

<p><strong>Authors: </strong>Don Bankes and Jennifer Blakc<br /> 
    <strong>Publication Date: </strong>January 2014</p> 

    <img alt="Request White Paper" src="http://icons.iconarchive.com/icons/artbees/paradise-fruits/256/Pear-icon.png" class="alignright" /> 
<p>The pear is any of several tree and shrub species of genus Pyrus /ˈpaɪrəs/, in the family Rosaceae. It is also the name of the pomaceous fruit of these trees. Several species of pear are valued for their edible fruit, while others are cultivated as ornamental trees. The genus Pyrus is classified in subtribe Pyrinae within tribe Pyreae.</p> 
    <p>The genus is thought to have originated in present-day western China in the foothills of the Tian Shan, a mountain range of Central Asia, and to have spread to the north and south along mountain chains, evolving into a diverse group of over 20 widely recognized primary species[citation needed]. The enormous number of varieties of the cultivated European pear (Pyrus communis subsp. communis), are without doubt derived from one or two wild subspecies (P. communis subsp. pyraster and P. communis subsp. caucasica), widely distributed throughout Europe, and sometimes forming part of the natural vegetation of the forests. Court accounts of Henry III of England record pears shipped from La Rochelle-Normande and presented to the King by the Sheriffs of the City of London. The French names of pears grown in English medieval gardens suggest that their reputation, at the least, was French; a favored variety in the accounts was named for Saint Rule or Regul', Bishop of Senli</p>