0
PLEASE HELP ME!!! Why do some code affect the outcome of others😞😞😞 and how to prevent it???
E.g. p { color:white; background-color:pink; } How can we stop this code from affecting the outcome of others???
2 Antworten
+ 1
Add code, so we can see exacly what is problem.
Probably you mean other paragraph?
You are selecting every paragraph, and changing its style.
To select only one, or group, you need to add id(if you select one) or class(to select more elements, what need to have same style), than select this in css.
Like:
<p id="anyName">asd</p>
<p>ayxcs</p>
#anyName {
color: red;
}
Here only first will have style.
Also you can use inline css on that element
+ 1
Because you are setting style for the tag <p>. Instead, you can use class selector to change styles of selected paragraphs only.
.stylish{
color:white;
background-color:pink;
}
<p class="stylish">
This paragraph will be affected
</p>
<p>
This paragraph will not be affected
</p>