Y
Y
YourQuestion2015-10-01 00:56:23
css
YourQuestion, 2015-10-01 00:56:23

How to set the properties of the next element?

<style>
.panel{
border:1px solid #000;
}
</style>

<div class="body">
    <div class="panel"></div>
    <div class="panel"></div>
</div>

Question: is it possible to set the property ' border-top:0px; ' for the next(2nd) block .panel ?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
Y
YourQuestion, 2015-10-01
@YourQuestion

remembered=) .panel:last-child or .panel:nth-child or .panel + .panel

V
Vladislav Soprun, 2015-10-01
@soprun

.panel {
  border: 1px solid black;
}
.panel + .panel {
  border-top-color: red;
}

Well, or through nth-child

T
Therapyx, 2015-10-01
@Therapyx

<style>
.panel{
border:1px solid #000;
}
.custom {
 border-top:0;
}
<div class="body">
    <div class="panel"></div>
    <div class="panel custom"></div>
</div>
</style>

you can add 2-3 ... classes by making changes like this. Just in order not to produce a bunch of dirt, it’s better to think in advance how and where to insert)

I
Ivanq, 2015-10-01
@Ivanq

.panel + * {
    border-top: 0px;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question