This question already has answers here:
How can I override inline styles with external CSS?
(7 answers)
Closed 8 years ago.
this is my style
<section id="text-13" class="widget widget_text">
<div class="widget-wrap">
<div class="textwidget">
<div style="background-color:#f7f6f6; padding: 15px;">
<div align="center">
<h2>Junte-se a mais de 4.137 assinantes:</h2>
</div>
how can I override the div style = background through CSS without editing the file.
According to this CSS Tricks Article:
.textwidget div[style] {
background: yellow !important;
}
You can use !important
.textwidget > div {background: none!important}
Related
This question already has answers here:
What does a space mean in a CSS selector? i.e. What is the difference between .classA.classB and .classA .classB? [duplicate]
(3 answers)
Closed 4 years ago.
i am trying to bind style in my css style using below format but its not working and i am learner for web development can some one help me please what is mistack?
css
.block-header.row.sample h1{
color: aqua;
}
html
<div class="block-header">
<div class="row sample">
<div class="col-sm-6">
<h1 class="page-title">Pending Approvals</h1>
</div>
</div>
</div>
The problem in your rule is that there are no spaces between your classes, which makes the selector any h1 element with the parent having classes block-header, row, and sample.
You would need to put spaces so that the selector knows these elements are nested inside each other:
.block-header .row.sample h1 {
color: aqua;
}
Learn more about how these selectors work from this FreeCodeCamp guide.
Your style rule is wrong, it should be: .block-header .row.sample h1 instead of .block-header.row.sample h1. When you have a style for an element that's a descendant of another one (in your case .row.sample is a child of .block-header) you should have the parent first, followed by a space (or > if it's a direct child) and then the descendant element, just like you're doing with the h1...
You can see it works with that simple change:
.block-header .row.sample h1{
color: aqua;
}
<div class="block-header">
<div class="row sample">
<div class="col-sm-6">
<h1 class="page-title">Pending Approvals</h1>
</div>
</div>
</div>
You can read more about selectors in mdn.
This question already has answers here:
Is there a CSS parent selector?
(33 answers)
Is there a "previous sibling" selector?
(30 answers)
Closed 5 years ago.
I have question about CSS selectors. I have below structure - I can only modiffy CSS - I don't have access to modify html or JS.
<div class="wrapper">
<div>
<div>
<div class="open">
</div>
</div>
</div>
<div>
<div class="top">
</div>
</div>
</div>
Class open will be toggled. Can I make selector when:
div in 4 line has open - div with class top => .top {top:50px}
div in 4 line not has open - div with class top => .top{top:0px;}
This is possible?
Try this:
.wrapper div:not(.open){
...
}
You will need to adjust it to the get the correct DIV, because this will affect all of them inside .wrapper
In your case it looks like you need something like:
.wrapper > div > div > div:not(...){...}
However, that is a bad practice.
You can read some more here:
https://developer.mozilla.org/en-US/docs/Web/CSS/:not
This question already has answers here:
CSS selector for first element with class
(23 answers)
Closed 5 years ago.
I've wrote this in HTML:
<div> hello</div>
<div class="name"><p>hello</p></div>
<div class="name"><p>hello</p></div>
and this in CSS:
div.name:first-child{
color: red;
}
I would like to change text color of second 'hello' to red. But it doesn't work. What I am doing wrong?
it's the second child, not the first, use nth-child:
div.name:nth-child(2){
color: red;
}
<div> hello</div>
<div class="name"><p>hello</p></div>
<div class="name"><p>hello</p></div>
This question already has answers here:
Using only CSS, show div on hover over another element
(14 answers)
Closed 5 years ago.
i Have used bootstrap and css , here is my code
<div class = "row" id="parent"=>
<div class="col-md-8" id="ClildDiv1">
//Some Content
</div>
<div class="col-md-4" id="ChildDiv2" style="display:none">
//Some Content
<div>
</div>
Now i want on hover on
<div class="row Parent>
All its Child should be visible in this case
<div class="col-md-4 ChildDiv2">
Any Help Would Be Appreciated And i want to achieve that only by CSS styling
You want one of the sibling selectors. General sibling ~ or next sibling +
.ClildDiv1:hover ~ .ChildDiv2 {
display: block;
}
See fiddle here
Or, the parent hover for any child div would be
.Parent:hover > div {
display: block;
}
This question already has answers here:
Is there a CSS parent selector?
(33 answers)
Closed 7 years ago.
I would like to know how to style an element according to his son.
.content p {
text-indent: 20;
}
<div class="content">
<p>1</p>
<p>2</p>
<p>
<iframe></iframe>
</p>
<!--I have to modify this paragraph-->
<p>4</p>
</div>
What do I need to do, is to modify the paragraph that has the iframe (text-indent: 0).
The best is to write something like
<p class="custom">...</p>
Then add style with
p.custom{
/* Your styles here */
}