查看我的代碼以瞭解我的意思。我希望整個背景都是黑色的。但是,在有文字的地方,背景只有黑色。如何用純色填充背景的其餘部分
下面是圖片:
<div style="background-color:black">
<img src="http://csc2.madonna.edu/~brabahy/hw5/images/Mercury1.jpg" style="float:left; margin-right:10px" height="400" width="400">
<p style="color:brown">Mercury is the smallest planet, and it's closest to the Sun of the eight planets in the Solar System. It has an orbital period of about 88 Earth days.</p>
</div>
定義「整個」。據我所知,整個div的背景是黑色的。你的意思是整個頁面? – light
會'body {background-color:black;}'嗎? – Banana
您應該閱讀一些關於樣式以及如何使用它來控制元素邊距和填充的內容。 – arkascha