Reputation: 7323
I have some divs like this:
Why is the border disappearing in the fourth case?
http://jsfiddle.net/ycyrwgcz/3/
html
<table>
<tr>
<td>
<div class="thumb"><div class="overlay"></div></div>
</td>
<td>
+
</td>
<td>
<div class="highlit thumb"><div class="overlay"></div></div>
</td>
<td>
+
</td>
<td>
<div class="framed thumb"><div class="overlay"></div></div>
</td>
<td>
=
</td>
<td>
<div class="highlit framed thumb"><div class="overlay"></div></div>
</td>
</tr>
</table>
with the css
body
{
background-color: #ff8888;
}
.thumb
{
width: 40px;
height: 40px;
display: inline-block;
margin: 10px;
background-color: #8888ff;
}
.overlay
{
height: 100%;
}
.thumb.framed .overlay
{
border: 2px solid #fff;
box-sizing: border-box;
}
.thumb.highlit .overlay
{
background-color: #fff;
opacity: 0.4;
}
Upvotes: 0
Views: 114
Reputation: 58442
It isn't disappearing - just blending in with the rest of the overlay and as you have set it to be opaque it will turn purple. If you are only wanting the background to be opaque and not the whole overlay you will need to use rgba background colours:
.thumb.highlit .overlay
{
background-color: rgba(255,255,255,0.4);
}
Upvotes: 1
Reputation: 558
You want this, should be self explaining ;)
.thumb.highlit .overlay {
background-color: rgba(255,255,255,0.4);
}
http://jsfiddle.net/fxxf6kcs/1/
Upvotes: 1
Reputation: 8521
Because the background-color
and border-color
is same (#fff
) in the fourth div.
You are using .overlay
class which has the following:
.thumb.highlit .overlay {
background-color: #fff;
opacity: 0.4;
}
.thumb.framed .overlay {
border: 2px solid #fff;
box-sizing: border-box;
}
Upvotes: 0
Reputation: 679
These are the css rules you have:
.thumb.highlit .overlay {
background-color: #FFF;
opacity: 0.4;
}
.thumb.framed .overlay {
box-sizing: border-box;
border: 2px solid #FFF;
}
Now, for the 4th <div>
both the above styles get mixed up. Means, there is a background-color: #fff
along with border: 2px solid #fff
.
As you can see, both these are white color. And because of this you're not able to distinguish the border.
Try to change the color
of any one of the above rules and you'll get the solution.
Hope this helps. :)
Upvotes: 1
Reputation: 277
Try this:
body
{
background-color: #ff8888;
}
.thumb
{
width: 40px;
height: 40px;
display: inline-block;
margin: 10px;
background-color: #8888ff;
}
.overlay
{
height: 100%;
}
.thumb.framed
{
border: 2px solid #fff;
box-sizing: border-box;
}
.thumb.framed .overlay
{
box-sizing: border-box;
}
.thumb.highlit .overlay
{
background-color: #fff;
opacity: 0.4;
}
Upvotes: 0