2016-08-03 149 views

回答

0

我不認爲這是一個特別的WP問題,但它可能會影響解決方案的更精細的細節。您提供的示例中的方法在非圖像區域上使用左側和右側填充。儘管如此,默認的WP編輯器不會將區域分割爲多個div。

你沒有提供你的HTML,但是,我會像接近...

.post-content { 
    box-sizing: border-box; // so that padding is part of the box area. 
} 
.post-content > * { // select all elements within your content area, or specifically things like p, h1, h2, etc. 
    display: block; 
    padding: 0 150px; // you could use padding using px, vw, etc. 
    width: 70%; // OR use width. compare this with to the image below 
} 
.post-content > img:first-of-type { // this might need to change to something to select the first image, or all images 
    width: 100%; // unlike the other elements, the image goes full width 
    height: auto; 
    padding: 0; 
}