Answer the question
In order to leave comments, you need to log in
How can I disable CSS styles for a specific line of HTML tags?
Hello everyone, I have a question how can I disable or make a certain line so that styles are not connected? The problem is that li a registered in css styles, created a new line not long ago and where I used the li and a tags, so the styles were connected to this line and the whole view was spoiled, well, I registered a certain style class in this line - li class = "list -item">
Answer the question
In order to leave comments, you need to log in
You can assign one style to the list and override specific items, like so:
<ul class="list-1">
<li>Первый элемент</li>
<li class="list-item">Второй элемент</li>
...
</ul>
<style>
.list-1 {
общий стиль;
}
.list-1 li.list-item {
другой стиль пункта;
}
</style>
If I understood the question correctly, then something like this
<ul class="list">
<li class="list-item">Первый элемент</li>
<li class="list-item">Второй элемент</li>
</ul>
.list-item {
color: red;
font-size: 20px;
}
.list-item:first-child {
all: unset;
}
if you added the list-item class for the elements of the new list, and you do not want the old styles to be applied to the elements of this list, add to the old selector :not(.list-item) between li and a
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question