我的HTML標記主要是段落,標題爲&。我無法編輯標記,但我很喜歡將內容填充到40像素,但將圖像的全寬度設置爲左側40像素和右側40像素。我怎樣才能使圖像完全流血,但填充內容
沒有jQuery的最佳方法是什麼?
這裏的HTML
<p>But how? Genius in the Sperm Whale? Has the Sperm Whale ever written a book, spoken a speech?</p>
<p>Champollion deciphered the wrinkled granite hieroglyphics. But there is no Champollion to decipher the Egypt of every man's and every being's face.</p>
<p><img src="http://lorempixel.com/400/200/sports" /></p>
<h2>If the Sperm Whale be physiognomically a Sphinx</h2>
<p>In the full-grown creature the skull will measure at least twenty feet in length. Unhinge the lower jaw, and the side view of this skull is as the side of a moderately inclined plane resting throughout on a level base.</p>
<p>It is plain, then, that phrenologically the head of this Leviathan, in the creature's living intact state, is an entire delusion.</p>
而CSS
p,h2{padding:0 40px;}
img{margin-left:-40px;width:100%;}
https://jsfiddle.net/xea3m64q/1/
的佈局是流體,所以我真的不想要固定寬度,如果我能幫助它。
刪除保證金左:-40px,並非常盡力 – stanze 2015-03-19 10:41:19