Есть сайт, на котором есть код, который я поместил в jsfiddle: https://jsfiddle.net/roa8k7js/
На сайте очень сложный стиль CSS, более 10000 строк.При переключении этого сайта на WordPress стилизация была сохранена, и все было помещено в тему.
Таким образом, каждый <section>
теперь находится в оболочке.Из-за этого стиль не работает должным образом.
Заполнение <section>
определяется рядом правил, включая, по крайней мере, одно основное правило, использующее селектор +
.
Правило выглядит следующим образом:
#layout1 .option-b:not(.custom-bg-image) + .option-b:not(.custom-bg-img)
{
padding-top: 0;
}
Поскольку обертка была добавлена, селектор +
не сможет правильно определить шаблон:
<div class="wrapper1">
<section class="option-b">This is some text</section>
</div>
<div class="wrapper1">
<section class="option-b">This is some more text - there shouldn't be any padding on top of this one</section>
</div>
section {
border: 1px solid black;
}
#layout1 .container1>section {
padding-top: 2em;
padding-bottom: 2em;
}
#layout1 .option-b:not(.custom-bg-image)+.option-b:not(.custom-bg-img) {
padding-top: 0;
}
#layout1 .container1>.wrapper1>section {
padding-top: 2em;
padding-bottom: 2em;
}
<div id="layout1">
<div class="container1">
<section class="option-b">This is some text</section>
<section class="option-b">This is some more text - notice how there isn't a padding top on this one</section>
</div>
</div>
<div id="layout1">
<div class="container1">
<div class="wrapper1">
<section class="option-b">This is some text</section>
</div>
<div class="wrapper1">
<section class="option-b">This is some more text - there shouldn't be any padding on top of this one</section>
</div>
</div>
</div>
Я пытаюсь определить, есть ли простой способ настроить CSS так, чтобы он мог правильно определить <section>
в следующей оболочке для установкизначение для top-padding
Также обратите внимание, что невозможно удалить обертки, и все разделы уже оформлены правильно, без них.