如何将div分配给文本

时间:2019-07-13 19:16:57

标签: html css wordpress

我有一些文本想要更改颜色,所以我给它分配了一个div类,#include "pch.h" #include <iostream> #include <omp.h> #include <stdio.h> int main() { printf("Cons space 1\n"); #pragma omp parallel { printf("Parallel space\n"); } printf("Cons space 2\n"); } 像这样:

donate

然后我使用CSS:

<div class="entry-content">
<div class="donate"><strong>Adsler.co.uk is an entirely free 
site, enabling users to post, view and apply for jobs, post, view 
and respond to classifieds, post, view and attend events, in 
addition to a dating service. We try to keep Adsler free from Google 
ads and the site is maintained entirely at the owners expense.</p>
<p>So, if you have enjoyed using Adsler, or have found it beneficial 
in some way, you are free to make a donation, or not &#8211; as you 
see fit. There is absolutely no obligation or pressure to do so and 
you are more than welcome to continue using the site without 
donating.</p>
<p>If you do wish to donate, however, then you can donate as much or 
as little as you want via the form below.</p>
<p>Wishing you a pleasant day from all at Adsler.co.uk.<br />
</strong></div><p>*N.B. Donating does not give you editorial or any 
other rights. All donations are non-refundable. For technical 
reasons, the only current donation amount is $5.</strong></div>

不起作用。发生的情况是文本闪烁黄色一秒钟,然后又变回黑色。另外,已经使用.donate {color: yellow !important;} ,但只有一半的文本定义为<strong>,另一半则没有。

说明页面:https://adsler.co.uk/if-you-enjoyed-using-the-site/

失败了,我使用了特异性。

strong

什么都没有。

2 个答案:

答案 0 :(得分:0)

这是解决方案。现在所有文本都变成黄色。

.donate {color: yellow !important;}
<div class="entry-content">
<div class="donate">Adsler.co.uk is an entirely free 
site, enabling users to post, view and apply for jobs, post, view 
and respond to classifieds, post, view and attend events, in 
addition to a dating service. We try to keep Adsler free from Google 
ads and the site is maintained entirely at the owners expense.
<p>So, if you have enjoyed using Adsler, or have found it beneficial 
in some way, you are free to make a donation, or not &#8211; as you 
see fit. There is absolutely no obligation or pressure to do so and 
you are more than welcome to continue using the site without 
donating.</p>
<p>If you do wish to donate, however, then you can donate as much or 
as little as you want via the form below.</p>
<p>Wishing you a pleasant day from all at Adsler.co.uk.</p><br>
<p>*N.B. Donating does not give you editorial or any 
other rights. All donations are non-refundable. For technical 
reasons, the only current donation amount is $5.</p></div></div>

答案 1 :(得分:0)

.donate {color: yellow}应该可以正常工作。但是一旦您的页面加载了* {color: #000000},它的颜色就会覆盖。

您无法通过添加!important来解决此问题,因此有两种选择:

1-从CSS移除* {color: #000000}

2-添加此CSS:

.donate, .donate * { 
color: yellow
}

.donate *将颜色更改为.donate及其所有子元素