简体   繁体   English

CSS 背景颜色部分但不是页面

[英]CSS Background color section but not page

I have section like this:我有这样的部分:

image1图像1

And I want section like this: image2我想要这样的部分: image2

When I change css of that section, I get results like on image 1. The problems are that sides, it leaves it white because that is background color of the whole page, but I don't want to change bg of the whole page.当我更改该部分的 css 时,我得到的结果如图 1 所示。问题是那一边,它留下白色,因为那是整个页面的背景颜色,但我不想更改整个页面的 bg。

I want the results like on the image2.我想要像 image2 上的结果。

in this case you don't have to set the background colour of whole(parent ) just change the background colour of chlild or child html element that you are using..its simple在这种情况下,您不必设置整个(父)的背景颜色,只需更改您正在使用的 chlild 或子 html 元素的背景颜色..它很简单

don't do this不要这样做

<div style="background-color:#fff">
</div>

do this做这个

<div>
<span style="color:#fff">name</span>
</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM