Not able to set background color - html

I am not able to set the background color for the #widgetContainer div. I was wondering if there is a way to align the div so that the empty space left out while floating an element can be minimized?
My Fiddle: jsfiddle.net/rLzb0caq

Your #widgetContainer has no height because all elements are floating. You should set the background color of #widgetContent instead, to get the desired result.
#widgetContent {
height: 50%;
width: 50%;
margin: 0 auto;
border: 3px groove solid red;
outline: 2px solid black;
background-color:yellow;
}
http://jsfiddle.net/inuya5ha/8ef7Lsvt/

Insert this tag before closing tag of #widgetContainer :
<span style="clear: both; display: block;"></span>
This will clear the floating of elements.

Change #widgetContent class to
#widgetContent {
background: none repeat scroll 0 0 #CCC;
height: 50%;
margin: 0 auto;
outline: 2px solid black;
width: 50%;
}

If you simply want background color to widgetContainer div, add overflow:hidden to #widgetContainer
#widgetContent {
height: 50%;
width: 50%;
margin: 0 auto;
border: 3px groove solid red;
outline: 2px solid black;
}
#widgetHead {
width: 100%;
height: 40px;
margin: 0 auto;
background-color: gray;
}
#widgetContainer {
height: 100%;
width: 100%;
background: gray;
color: black;
margin-top: 10px;
margin-bottom: 10px;
overflow: hidden;
}
#widgetContainer > div {
float: left;
width: 31%;
min-height: 75px;
margin: 1%;
-webkit-box-shadow: 6px -7px 12px -1px rgba(0, 0, 0, 0.5);
-moz-box-shadow: 6px -7px 12px -1px rgba(0, 0, 0, 0.5);
box-shadow: 6px -7px 12px -1px rgba(0, 0, 0, 0.5);
border: 0.25% solid;
}
#widgetContainer > div div {
width: 80%;
min-height: 75px;
padding: 1%;
margin: 2% auto;
overflow: auto;
-webkit-box-shadow: 6px -7px 12px -1px rgba(0, 0, 0, 0.5);
-moz-box-shadow: 6px -7px 12px -1px rgba(0, 0, 0, 0.5);
box-shadow: 6px -7px 12px -1px rgba(0, 0, 0, 0.5);
border: 0.25% solid black;
}
.clean {
margin-bottom: 20px;
clear: both;
}
<div id="widgetContent">
<div id="widgetHead">
widgetData
</div>
<div id="widgetContainer">
<div id="node1" style="background-color: red;">
node1
<div id="vip1" style="background-color: red;">
vip1
<div id="obj1" style="background-color: gray;">
obj1
</div>
<div id="obj2" style="background-color: green;">
obj2
</div>
<div id="obj3" style="background-color: green;">
obj3
</div>
</div>
<div id="vip2" style="background-color: blue;">
vip2
</div>
</div>
<div id="node2">
node2
<div id="vip1" style="background-color: green;">
vip1
</div>
<div id="vip2" style="background-color: green;">
vip2
</div>
</div>
<div id="node3" style="background-color: red;">
node3
</div>
<div id="node4" style="background-color: red;">
node4
</div>
<div id="node5" style="background-color: red;">
node5
</div>
<div id="node6" style="background-color: red;">
node6
</div>
<div id="node7" style="background-color: red;">
node7
</div>
<div id="node8" style="background-color: red;">
node8
</div>
<div id="node1" style="background-color: red;">
node1
<div id="vip1" style="background-color: red;">
vip1
<div id="obj1" style="background-color: gray;">
obj1
</div>
<div id="obj2" style="background-color: green;">
obj2
</div>
<div id="obj3" style="background-color: green;">
obj3
</div>
</div>
<div id="vip2" style="background-color: blue;">
vip2
</div>
</div>
</div>
<div class="clean cf">
</div>
</div>

Related

Horizontally centre '::before' item and other div element with flex concept in Bootstrap 4

.status-light-red::before{
background-color: rgb(255, 0, 0);
box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
-webkit-box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
-moz-box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
}
.status-light::before{
content: "";
height: 10px;
width: 10px;
position: absolute;
border-radius: 50%;
top:50%;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.3.1/dist/css/bootstrap.min.css">
<div class="container py-5">
<div class="row job-list-view-section">
<div class="col-12">
<div class="d-flex justify-content-between align-items-center border border-dark my-shadow p-4">
<div>
<span>1</span>
</div>
<div>
<p>Company Name</p>
</div>
<div>
<p>Applied Job For</p>
</div>
<div>
<p>status</p>
</div>
<div class="status-light status-light-red"></div>
</div>
</div>
</div>
</div>
I am using here bootstrap 4.3.1 with flex concept with some custom pieces of CSS. Here the status-light and other div items are not proper center horizontally, how am I doing center horizontally?
Note: Don't want a solution by adding custom top property value (Ex. top:58%; or top:58px;), I need a proper logical solution.
You might use vertical translation to bring it up in line with the text elements. Notice that I stripped out the span and paragraph elements which don't seem to be doing anything.
.status-light-red::before{
background-color: rgb(255, 0, 0);
box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
}
.status-light::before{
content: "";
height: 10px;
width: 10px;
position: absolute;
border-radius: 50%;
transform: translateY(-50%);
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.3.1/dist/css/bootstrap.min.css">
<div class="container py-5">
<div class="row job-list-view-section">
<div class="col-12">
<div class="d-flex justify-content-between align-items-center border border-dark my-shadow p-4">
<div>1</div>
<div>Company Name</div>
<div>Job Applied For</div>
<div>Status</div>
<div class="status-light status-light-red"></div>
</div>
</div>
</div>
</div>
You can give the p the same line-height as the container - here I added some borders and padding just to be painfully obvious what is where.
I also made some p into a div because that seems "cleaner" given your requirement.
.job-list-view-section {
border: 2px blue solid;
padding: 0.25rem;
}
.job-list-view-section .col-12 {
border: 1px red solid;
padding: 0.25rem;
}
.job-list-view-section .col-12 .d-flex {
padding: 0.25rem;
}
.job-list-view-section .col-12 .my-shadow>* {
border: 1px green solid;
display: flex;
align-items: center;
justify-content: center;
height:3rem;
}
.job-list-view-section .col-12 .my-shadow>*>p {
background-color: #ddffdd;
display: inline-block;
align-self: flex-start;
line-height: 2.9rem; /*match to align text in the p to the green box, less than 3 for the borders */
}
.wrap-things {
width: 3rem;
height: 3rem;
display: flex;
align-items: center;
justify-content: center;
border: solid 1px lime;
align-self: center;
}
.status-light {
border: solid 1px lime;
height: 0.5rem;
width: 0.5rem;
}
.status-light-red::before {
background-color: rgb(255, 0, 0);
box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
-webkit-box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
-moz-box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
}
.status-light::before {
content: "";
border-radius: 50%;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<div class="container py-5">
<div class="row job-list-view-section">
<div class="col-12">
<div class="d-flex justify-content-between align-items-center border border-dark my-shadow p-4">
<div>
<span>1</span>
</div>
<div>
<div>Company Name</div>
</div>
<div>
<p>Applied Job For</p>
</div>
<div>
<div>status</div>
</div>
<div class="wrap-things">
<div class="status-light status-light-red"></div>
</div>
</div>
</div>
</div>
</div>
See, borders:
.status-light-red::before{
background-color: rgb(255, 0, 0);
box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
-webkit-box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
-moz-box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
}
.status-light::before{
content: "";
height: 10px;
width: 10px;
position: absolute;
border-radius: 50%;
top:50%;
}
.my-shadow >div{border: solid 1px red;}
.my-shadow >div>p{border: solid 1px lime;}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.3.1/dist/css/bootstrap.min.css">
<div class="container py-5">
<div class="row job-list-view-section">
<div class="col-12">
<div class="d-flex justify-content-between align-items-center border border-dark my-shadow p-4">
<div>
<span>1</span>
</div>
<div>
<p>Company Name</p>
</div>
<div>
<p>Applied Job For</p>
</div>
<div>
<p>status</p>
</div>
<div class="status-light status-light-red"></div>
</div>
</div>
</div>
</div>
Remove the padding from <p>.
Also, to align the red dot add top: calc(50% - 5px); to ::before.
See MDN calc.
.status-light-red::before{
background-color: rgb(255, 0, 0);
box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
-webkit-box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
-moz-box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
}
.status-light::before{
content: "";
height: 10px;
width: 10px;
position: absolute;
border-radius: 50%;
top: calc(50% - 5px);
}
.job-list-view-section p{
margin-bottom: 0;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<div class="container py-5">
<div class="row job-list-view-section">
<div class="col-12">
<div class="d-flex justify-content-between align-items-center border border-dark my-shadow p-4">
<div>
<span>1</span>
</div>
<div>
<p>Company Name</p>
</div>
<div>
<p>Applied Job For</p>
</div>
<div>
<p>status</p>
</div>
<div class="status-light status-light-red"></div>
</div>
</div>
</div>
</div>
also, you could try displaying the parent flex like
.status-light-red::before {
background-color: rgb(255, 0, 0);
box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
-webkit-box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
-moz-box-shadow: 0px 0px 5px 2px rgb(255 0 0 / 75%);
}
.status-light{
display: flex;
align-items: center;
justify-content: center;
}
.status-light::before{
content: "";
height: 10px;
width: 10px;
position: absolute;
border-radius: 50%;
/*top pos removed*/
}
.job-list-view-section p {
margin-bottom: 0;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<div class="container py-5">
<div class="row job-list-view-section">
<div class="col-12">
<div class="d-flex justify-content-between align-items-center border border-dark my-shadow p-4">
<div>
<span>1</span>
</div>
<div>
<p>Company Name</p>
</div>
<div>
<p>Applied Job For</p>
</div>
<div>
<p>status</p>
</div>
<div class="status-light status-light-red"></div>
</div>
</div>
</div>
</div>

How i can put elements inline html

I have a problem with my elements.
I have 3 elements in left, and 3 elements in right.
I don't really know CSS, and
i want the 3 elements in right be align with 3 elements in left.
Thank you for you time, i hope you understand what i want to do!
**My code:**
<link rel="stylesheet" type="text/css" href="assets/css/style.css">
<link rel="stylesheet" type="text/css" href="https://web.ryanteel.repl.co/bootstrap.min.css">
<script src="assets/js/jquery-3.2.1.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
</head>
<style>
.card-adryan {
margin: 0 auto;
/* Added */
float: none;
/* Added */
margin-bottom: 10px;
/* Added */
}
.card-header-adryan {
padding: .75rem 1.25rem;
margin-bottom: 0;
background-color: rgb(0, 0, 0);
color: white;
font-weight: bold;
}
.card-adryan {
position: relative;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
min-width: 0;
word-wrap: break-word;
background-color: rgba(0, 0, 0, 0.5);
background-clip: border-box;
border: 1px solid rgb(0, 0, 0);
border-radius: .25rem;
color: white;
}
.slot-left {
width: 18%;
height: 57px;
float: left;
border-top: rgba(0, 0, 0, 0.5);
border-left: rgba(0, 0, 0, 0.5);
border-bottom: rgba(0, 0, 0, 0.5);
border-right: rgba(0, 0, 0, 0.5);
background-color: rgba(0, 0, 0, 0.5);
opacity: 0.5;
}
.slot-right {
width: 18%;
height: 57px;
float: right;
border-top: rgba(0, 0, 0, 0.5);
border-left: rgba(0, 0, 0, 0.5);
border-bottom: rgba(0, 0, 0, 0.5);
border-right: rgba(0, 0, 0, 0.5);
background-color: rgba(0, 0, 0, 0.5);
opacity: 0.5;
}
</style>
<body>
<div class="container">
<div class="card-adryan" style="width: 20rem;">
<div class="card-header-adryan">
Character
</div>
<div class="card-body">
<div class="left-a-b">
<div class="slot-left">
</div>
<br>
<br>
<br>
<div class="slot-left">
</div>
<br>
<br>
<br>
<div class="slot-left">
</div>
</div>
<div class="right-a-b">
<div class="slot-right">
</div>
<br>
<br>
<br>
<div class="slot-right">
</div>
<br>
<br>
<br>
<div class="slot-right">
</div>
</div>
</div>
</div>
</div>
<script src="assets/js/main.js"></script>
<!--
<script type="text/javascript">
$('.alert-danger').hide();
</script>
-->
</body>
I see you are using Bootstrap so you can simply use it's css (row, col) like this:
Just change your classes slot-left and slot-right width to be width: 36%; instead of width: 18%;.
Add row class to your card-body div => <div class="card-body row">.
Add col-6 class to your left-a-b & right-a-b divs => [<div class="left-a-b col-6"> & <div class="right-a-b col-6">].
so your total code should look like this:
.card-adryan {
margin: 0 auto; /* Added */
float: none; /* Added */
margin-bottom: 10px; /* Added */
}
.card-header-adryan{
padding:.75rem 1.25rem;
margin-bottom:0;
background-color:rgb(0,0,0);
color: white;
font-weight: bold;
}
.card-adryan{
position:relative;
display:-webkit-box;
display:-ms-flexbox;
display:flex;
-webkit-box-orient:vertical;
-webkit-box-direction:normal;
-ms-flex-direction:column;
flex-direction:column;
min-width:0;
word-wrap:break-word;
background-color: rgba(0, 0, 0, 0.5);
background-clip:border-box;
border:1px solid rgb(0,0,0);
border-radius:.25rem;
color: white;
}
.slot-left {
width: 36%;
height: 57px;
float: left;
border-top: rgba(0, 0, 0, 0.5);
border-left: rgba(0, 0, 0, 0.5);
border-bottom: rgba(0, 0, 0, 0.5);
border-right: rgba(0, 0, 0, 0.5);
background-color: rgba(0, 0, 0, 0.5);
opacity: 0.5;
}
.slot-right {
width: 36%;
height: 57px;
float: right;
border-top: rgba(0, 0, 0, 0.5);
border-left: rgba(0, 0, 0, 0.5);
border-bottom: rgba(0, 0, 0, 0.5);
border-right: rgba(0, 0, 0, 0.5);
background-color: rgba(0, 0, 0, 0.5);
opacity: 0.5;
}
<link rel="stylesheet" type="text/css" href="assets/css/style.css">
<link rel="stylesheet" type="text/css" href="https://web.ryanteel.repl.co/bootstrap.min.css">
<div class="container">
<div class="card-adryan" style="width: 20rem;">
<div class="card-header-adryan">
Character
</div>
<div class="card-body row">
<div class="left-a-b col-6">
<div class="slot-left">
</div>
<br>
<br>
<br>
<div class="slot-left">
</div>
<br>
<br>
<br>
<div class="slot-left">
</div>
</div>
<div class="right-a-b col-6">
<div class="slot-right">
</div>
<br>
<br>
<br>
<div class="slot-right">
</div>
<br>
<br>
<br>
<div class="slot-right">
</div>
</div>
</div>
</div>
</div>
You need to place the display: flex on your card-body and place a space-between for your justify-content setting. Add some padding to move from side.
.card-adryan {
margin: 0 auto; /* Added */
margin-bottom: 10px; /* Added */
}
.card-header-adryan{
padding:.75rem 1.25rem;
margin-bottom:0;
background-color:rgb(0,0,0);
color: white;
font-weight: bold;
}
.card-adryan{
position:relative;
-webkit-box-orient:vertical;
-webkit-box-direction:normal;
-ms-flex-direction:column;
flex-direction:column;
word-wrap:break-word;
background-color: rgba(0, 0, 0, 0.5);
background-clip:border-box;
border:1px solid rgb(0,0,0);
border-radius:.25rem;
color: white;
}
.card-body {
padding: 20px;
display: flex;
justify-content: space-between;
}
.slot-left {
width: 57px;
height: 57px;
border-top: rgba(0, 0, 0, 0.5);
border-left: rgba(0, 0, 0, 0.5);
border-bottom: rgba(0, 0, 0, 0.5);
border-right: rgba(0, 0, 0, 0.5);
background-color: rgba(0, 0, 0, 0.5);
opacity: 0.5;
}
.slot-right {
width: 57px;
height: 57px;
border-top: rgba(0, 0, 0, 0.5);
border-left: rgba(0, 0, 0, 0.5);
border-bottom: rgba(0, 0, 0, 0.5);
border-right: rgba(0, 0, 0, 0.5);
background-color: rgba(0, 0, 0, 0.5);
opacity: 0.5;
}
<div class="container">
<div class="card-adryan" style="width: 20rem;">
<div class="card-header-adryan">
Character
</div>
<div class="card-body">
<div class="left-a-b">
<div class="slot-left">
</div>
<br>
<br>
<br>
<div class="slot-left">
</div>
<br>
<br>
<br>
<div class="slot-left">
</div>
</div>
<div class="right-a-b">
<div class="slot-right">
</div>
<br>
<br>
<br>
<div class="slot-right">
</div>
<br>
<br>
<br>
<div class="slot-right">
</div>
</div>
</div>
</div>
</div>
you can use CSS grids to solve this
first, create your grid container with 9 cells (to leave the second column empty)
<div class="grid-container">
<div class="grid-item">1</div>
<div class="grid-item">2</div>
<div class="grid-item">3</div>
<div class="grid-item">4</div>
<div class="grid-item">5</div>
<div class="grid-item">6</div>
<div class="grid-item">7</div>
<div class="grid-item">8</div>
<div class="grid-item">9</div>
</div>
<style>
.grid-container {
display: grid;
grid-template-columns: auto auto auto;
padding: 10px;
}
.grid-item {
border: 1px solid rgba(0, 0, 0, 0.8);
padding: 20px;
font-size: 30px;
text-align: center;
}
</style>
then put your first three-element in (1, 4, 7)
the other three in (3, 6, 9)

how to make only jumbotron background image dark

i have jumbotron with a background image , i put a
-webkit-filter: brightness(30%); on the background image, but this effect also affects all other images and text in the jumbotron, i am trying to make only the background image dull, and all other text and images bright, can anyone please assist me
.jumbotron {
background-image: url("apartment.jpg");
height: 500px;
width: 100%;
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
-webkit-filter: brightness(30%);
}
img#sub {
padding: 5px;
border: solid 1px #EFEFEF;
height: 100%;
width: 100%;
}
img.hover-shadow {
transition: 0.3s;
}
.hover-shadow:hover {
border: solid 1px #CCC;
-moz-box-shadow: 1px 1px 5px #999;
-webkit-box-shadow: 1px 1px 5px #999;
box-shadow: 1px 1px 5px #999;
}
<section>
<h2 class="section-title" style="word-wrap:break-word;"> <span id="section32"> </span> APARTMENTS</h2>
<div align="center">
<img id="divider" src="divide1.png">
</div>
<br></br>
<div class="jumbotron">
<h2 style="text-align:center">Apartments</h2>
<div align="center" class="container-fluid" id="ab">
<div id="sub" class="column">
<img id="sub" src="8.jpg" style="width:70%" onclick="openModal();currentSlide(2)" class="hover-shadow cursor">
</div>
<div id="sub" class="column">
<img id="sub" src="10.jpg" style="width:70%" onclick="openModal();currentSlide(2)" class="hover-shadow cursor">
</div>
</div>
</div>
</section>
below is an image showing the dark effect all over
image
Is this what you are looking for? Instead of styling the background image container, I added a :before pseudo element to it, and set it to have a black overlay with an opacity of 50% using rgba.
.jumbotron{background-image: url("http://placekitten.com/1000/700");
height: 500px;
width: 100%;
background-position: center center;background-repeat: no-repeat;background-size: cover;
position: relative;
}
.column {
display: inline-block;
margin: 5px;
}
img.subImg {
padding: 5px;
border: solid 1px #EFEFEF;
height: 100%;
width: 100%;
position: relative;
z-index: 10;
width: 300px;
}
.jumbotron:before {
content: '';
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0,0,0,.5);
}
img.hover-shadow {
transition: 0.3s;
}
.hover-shadow:hover {
border: solid 1px #CCC;
-moz-box-shadow: 1px 1px 5px #999;
-webkit-box-shadow: 1px 1px 5px #999;
box-shadow: 1px 1px 5px #999;
}
<section >
<h2 class="section-title" style="word-wrap:break-word;" > <span
id="section32" > </span> APARTMENTS</h2>
<div align="center">
<img id="divider" src="divide1.png" >
</div>
<div class="jumbotron">
<h2 style="text-align:center">Apartments</h2>
<div align="center" class="container-fluid" id="ab">
<div id="sub1" class="column">
<img class="subImg" src="http://placekitten.com/500/300"
onclick="openModal();currentSlide(2)" class="hover-shadow cursor">
</div>
<div id="sub2" class="column">
<img class="subImg" src="http://placekitten.com/500/300"
onclick="openModal();currentSlide(2)" class="hover-shadow cursor">
</div>
</div>
</div>
</section>
How about overlapping background-image
background-image:
linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)) ,
url("Your URL");
.jumbotron {
background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0)), url("https://upload.wikimedia.org/wikipedia/commons/3/38/Tampa_FL_Sulphur_Springs_Tower_tall_pano01.jpg");
height: 500px;
width: 100%;
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
-webkit-filter: brightness(100%);
}
.jumbotron img {
-webkit-filter: none;
}
img#sub {
padding: 5px;
border: solid 1px #efefef;
height: 100%;
width: 100%;
}
img.hover-shadow {
transition: 0.3s;
}
.hover-shadow:hover {
border: solid 1px #ccc;
-moz-box-shadow: 1px 1px 5px #999;
-webkit-box-shadow: 1px 1px 5px #999;
box-shadow: 1px 1px 5px #999;
}
.column {
position: relative;
}
.img-out {
position: relative;
}
.img-text {
position: absolute;
top: calc(45% - 24px);
right: 0;
bottom: 0;
left: 0;
font-size: 24px;
vertical-align: middle;
color: red;
font-weight: 900;
}
<section>
<h2 class="section-title" style="word-wrap:break-word;"> <span id="section32"> </span> APARTMENTS</h2>
<div align="center">
<img id="divider" src="http://www.gettyimages.in/gi-resources/images/Homepage/Hero/US/MAR2016/prestige-587705839_full.jpg">
</div>
<br></br>
<div class="jumbotron">
<h2 style="text-align:center">Apartments</h2>
<div align="center" class="container-fluid" id="ab">
<div id="sub" class="column">
<div class="img-out">
<img id="sub" src="https://html5box.com/html5lightbox/images/lakeandballoon.jpg" style="width:70%" onclick="openModal();currentSlide(2)" class="hover-shadow cursor">
</div>
<div class="img-text">
<p>TEXT 1</p>
</div>
</div>
<div id="sub" class="column">
<div class="img-out">
<img id="sub" src="http://eskipaper.com/images/image-2.jpg" style="width:70%" onclick="openModal();currentSlide(2)" class="hover-shadow cursor">
</div>
<div class="img-text">
<p>TEXT 1</p>
</div>
</div>
</div>
</div>
</section>
Try this.
background-image: rgba(0, 0, 0, 0.4), url("apartment.jpg");
background-image can take multiple values.

Box-shadow is overlapping other elements, how can I fix it?

Basically because of how HTML orders elements (the last one has the highest priority over the others) my shadows overlap other elements. If I use z-index on the first element then that is the only one that doesn't overlap, I don't know how to do it for all of them.
This is what I currently have (ignore the shadow size difference, I did it on purpose to see my problem):
This is what I should have:
Here's my code:
CSS:
.timer-container {
font-size: 0;
}
.timer-container .timer {
font-size: 16px;
width: 110px;
height: 170px;
display: inline-block;
background-color: #ffffff;
color: red;
margin: 0 5px;
-webkit-box-shadow: 0 26px 57px 0 rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 26px 57px 0 rgba(0, 0, 0, 0.2);
box-shadow: 0 26px 57px 0 rgba(0, 0, 0, 0.2);
}
.timer-container .time {
height: 120px;
font: 4em serif;
border-bottom: 1px solid #bdd9f6;
padding: 15px 0 0;
}
.timer-container .label {
height: 50px;
font: 1.125em serif;
text-transform: uppercase;
}
HTML:
<div class="timer-container">
<div class="timer">
<div class="time">
<span>12</span>
</div>
<div class="label">
<span>jours</span>
</div>
</div>
<div class="timer">
<div class="time">
<span>17</span>
</div>
<div class="label">
<span>heures</span>
</div>
</div>
<div class="timer">
<div class="time">
<span>48</span>
</div>
<div class="label">
<span>minutes</span>
</div>
</div>
<div class="timer">
<div class="time">
<span>05</span>
</div>
<div class="label">
<span>secondes</span>
</div>
</div>
This could be a way. Split your shadow boxes from your timers, so you can use z-index to put them behind the timers.
.timer-container {
font-size: 0;
position: relative;
}
.timer-container .timer {
font-size: 16px;
width: 110px;
height: 170px;
display: inline-block;
background-color: #ffffff;
color: red;
margin: 0 5px;
}
.timer-container .time {
height: 120px;
font: 4em serif;
border-bottom: 1px solid #bdd9f6;
padding: 15px 0 0;
}
.timer-container .label {
height: 50px;
font: 1.125em serif;
text-transform: uppercase;
}
.timer-shadow {
position: absolute;
left: 0;
top: 0;
z-index:-1;
}
.timer-shadow span {
margin: 0 5px;
display: inline-block;
-webkit-box-shadow: 0 26px 57px 0 rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 26px 57px 0 rgba(0, 0, 0, 0.2);
box-shadow: 0 26px 57px 0 rgba(0, 0, 0, 0.2);
width: 110px;
height: 170px;
}
<div class="timer-container">
<div class="timer" style="z-index:4;">
<div class="time">
<span>12</span>
</div>
<div class="label" style="z-index:3;">
<span>jours</span>
</div>
</div>
<div class="timer" style="z-index:2;">
<div class="time">
<span>17</span>
</div>
<div class="label">
<span>heures</span>
</div>
</div>
<div class="timer" style="z-index:1;">
<div class="time">
<span>48</span>
</div>
<div class="label">
<span>minutes</span>
</div>
</div>
<div class="timer">
<div class="time">
<span>05</span>
</div>
<div class="label">
<span>secondes</span>
</div>
</div>
<div class="timer-shadow">
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</div>

Why does this relatively positioned element render below its parent?

JSFiddle.
In this SSCCE, the first div.number-outer-container renders below its parent div.step-container.
The question is that why is this happening, and what can I do to make it render vertically at the right place?
I have tried to apply a top:0 to div.number-outer-container but it does not seem to affect anything.
Note: This is just an SSCCE, actually each div.step-container is added dynamically, and any number of div.step-containers can be added.
.wrapper-big {
height: 600px;
overflow-y: auto;
width: 100%;
}
.wrapper {
height: 100%;
width: 826px;
margin: 50px auto;
display: table;
background-color: #003b80;
}
.cell {
display: table-cell;
vertical-align: top;
}
.left-cell {
width: 50%;
background-color: chocolate;
}
.right-cell {
background-color: darkslategrey
}
.step-container {
max-height: 200px;
font-size: 0;
}
.right-cell .step-container {
margin-top: 125px;
direction: rtl;
}
.content-box {
display: inline-block;
width: 350px;
height: 200px;
/*border: 5px solid blue;*/
font-size: 0;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.69);
-moz-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.69);
-webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.69);
background-color: dodgerblue
}
.right-cell .content-box {
background-color: darkturquoise
}
.middle-cell {
height: 100%;
background-color: white;
width: 1.5px;
font-size: 0;
box-shadow: 0px 0px 10px black;
-moz-box-shadow: 0px 0px 10px black;
-webkit-box-shadow: 0px 0px 10px black;
}
.number-outer-container {
display: inline-block;
/*position:absolute;*/
position: relative;
left: 390px;
}
.left-cell .number-outer-container {
/*margin-left:39px;*/
}
.left-cell .number-outer-container {
left:390px;
}
.right-cell .number-outer-container {
right:390px;
}
.number-inner-container {
height: 200px;
display: flex;
flex-direction: column;
justify-content: center;
}
.number-banner {
width: 50px;
height: 50px;
background-color: crimson;
-moz-border-radius: 25px;
-webkit-border-radius: 25px;
border-radius: 25px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
-moz-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
-webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
font-size:22px;
font-weight:bold;
color:white;
line-height:50px;
text-align:center;
}
.notch-outer-container {
display: inline-block;
}
.left-cell .notch-outer-container {
/*margin-right: 24px;*/
}
.right-cell .notch-outer-container {
/*margin-left: 22px;*/
}
.notch-inner-container {
height: 200px;
display: flex;
flex-direction: column;
justify-content: center;
}
.notch {
width: 0;
height: 0;
border-top: 15px solid transparent;
border-bottom: 15px solid transparent;
}
.left-face-notch {
border-right: 15px solid #520f23;
}
.right-face-notch {
border-left: 15px solid #571780;
}
<div class="wrapper-big">
<div class="wrapper">
<div class="cell left-cell" align="left">
<!-- -->
<div class="step-container">
<div class="content-box"></div>
<div class="notch-outer-container">
<div class="notch-inner-container">
<div class="right-face-notch notch"></div>
</div>
</div>
<div class="number-outer-container">
<div class="number-inner-container">
<div class="number-banner">1</div>
</div>
</div>
</div>
<!-- -->
<div class="step-container" style="margin-top:50px;">
<div class="content-box"></div>
<div class="notch-outer-container">
<div class="notch-inner-container">
<div class="right-face-notch notch"></div>
</div>
</div>
<div class="number-outer-container">
<div class="number-inner-container">
<div class="number-banner">3</div>
</div>
</div>
</div>
<!-- -->
<div class="step-container" style="margin-top:50px;">
<div class="content-box"></div>
<div class="notch-outer-container">
<div class="notch-inner-container">
<div class="right-face-notch notch"></div>
</div>
</div>
<div class="number-outer-container">
<div class="number-inner-container">
<div class="number-banner">5</div>
</div>
</div>
</div>
<!-- -->
</div>
<div class="cell middle-cell"></div>
<div class="cell right-cell" align="right">
<!-- -->
<div class="step-container" style="margin-top:125px;">
<div class="content-box"></div>
<div class="notch-outer-container">
<div class="notch-inner-container">
<div class="left-face-notch notch"></div>
</div>
</div>
<div class="number-outer-container">
<div class="number-inner-container">
<div class="number-banner">2</div>
</div>
</div>
</div>
<!-- -->
<div class="step-container" style="margin-top:50px;">
<div class="content-box"></div>
<div class="notch-outer-container">
<div class="notch-inner-container">
<div class="left-face-notch notch"></div>
</div>
</div>
<div class="number-outer-container">
<div class="number-inner-container">
<div class="number-banner">4</div>
</div>
</div>
</div>
<!-- -->
<div class="step-container" style="margin-top:50px;">
<div class="content-box"></div>
<div class="notch-outer-container">
<div class="notch-inner-container">
<div class="left-face-notch notch"></div>
</div>
</div>
<div class="number-outer-container">
<div class="number-inner-container">
<div class="number-banner"></div>
</div>
</div>
</div>
<!-- -->
</div>
</div>
<!-- .wrapper -->
</div>
<!-- .wrapper-big -->
You could set position:relative to the parent container, and set position:absolute on the child element, so they will always stay together.
Read this post if you're interested in learning more about the details of how position works.
UPDATED DEMO
.cell .step-container {
position: relative;
}
.cell .number-outer-container {
position: absolute;
top: 0;
}
.left-cell .number-outer-container {
left: 390px;
}
.right-cell .number-outer-container {
left: -20px;
}
.left-face-notch,
.right-face-notch {
position: absolute;
top: 85px; /*200/2 - 30/2*/
}
Because of div.notch-outer-container and div.content-box, are taking up all the space. And since all the divs are inline-block.
If you set position:absolute; top:0; on div.number-outer-container and remove position:relative then it goes up.
http://jsfiddle.net/7dte3ru6/5/