0

Is there a way to create a certain html wrapper element for js purposes only, who doesn't bother the css?

So I can still use the > sign as selector, like the example.

Example:

.container > .row {  
  margin:10px;
}
<div class="container">
  <div id="divWrapper123">
    <div class="row">
    </div>
  </div>
</div>
0

1 Answer 1

1

no, > in css always mean direct child. you can instead use jquery to apply styling, or you can give the row another class and use it to style:

<div class="container">
  <div id="divWrapper123">
    <div class="row m10">
    </div>
  </div>
</div>


.container .m10{  
  margin:10px;
}
Sign up to request clarification or add additional context in comments.

3 Comments

Alternatively, they could apply the ID to the existing parent object <div class="container" id="divWrapper123">
The problem is that I am using a css framework where the row needs to be directly after the container. The div with the id will only append when user is logged in to edit something.
can you add the new class .m10? If you can then there is no problem, it will always work

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.