How to make dark overlay for 4 divs using bootstrap - html

I have 4 divs with image as background and I want them all to have a dark overlay, but the absolute position is somehow messing things up because all 4 overlays end up over the first div when I want each to include all 4 divs.
Thanks in advance!

You should set the .overlay as a child of the .factorImg div and make .factorImg have position: relative, otherwise the .overlay will be set absolute to .row.
You could also look into pseudo-classe (:before and :after):
https://www.w3schools.com/css/css_pseudo_classes.asp

Put <div class="overlay1"></div> tag inside factorImg1 div and give it to position:relative. Do same thing in all respective div.

Put your overlay divs inside bootstrap columns which will have display: relative by default. Check below snippet for reference.
.overlay1,
.overlay2,
.overlay3,
.overlay4 {
width: 14.7%;
height: 270px;
background-color: #000000;
opacity: 0.5;
position: absolute;
left: 0;
top: 0;
bottom: 0;
}
.factorImgText {
position: absolute;
z-index: 1;
padding: 0 5px;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
margin: 0;
text-align: center;
width: 90%;
}
.factorSection h6,
.factorSection p {
color: #fff;
font-weight: 900;
}
.factorSection h6 {
font-size: 1em;
text-align: center;
width: 90%;
}
.factorSection p {
font-size: .75em;
line-height: 1.4em;
margin-bottom: 0;
}
.factorImg1,
.factorImg2,
.factorImg3,
.factorImg4 {
background: rgba(0, 0, 0, 0.6);
opacity: 1;
height: auto;
padding-top: 8%;
padding-bottom: 8%;
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
height: 270px;
width: 23.8%;
position: relative;
}
.factorImg1 {
background-image: url('http://kleingartenverein-aligse.de//images/wallpaper/Oct/fall-1072821_1920.jpg');
margin-right: 10px;
}
.factorImg2 {
background-image: url('http://kleingartenverein-aligse.de//images/wallpaper/Oct/fall-1072821_1920.jpg');
margin-right: 10px;
}
.factorImg3 {
background-image: url("http://kleingartenverein-aligse.de//images/wallpaper/Oct/fall-1072821_1920.jpg");
margin-right: 10px;
}
.factorImg4 {
background-image: url("http://kleingartenverein-aligse.de//images/wallpaper/Oct/fall-1072821_1920.jpg");
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="background_section2">
<div id="section2-05" class="container">
<div class="row">
<div class="col-lg-12 col-sm-12">
<h2>¿QUÉ ES EL FACTOR ZURPRAIS?</h2>
<p>¡Mucho más que el factor sorpresa!</p>
</div>
</div>
<div class="row factorSection">
<div class="col-sm-3 col-xs-12 factorImg1">
<div class="factorImgText">
<h6>2 DÍAS ANTES… ¡ZURPRAIS!</h6>
<p>Con tu pack de experiencias, tu edad y tu perfil (familias, parejas, amig#s…), organizaremos tu plan… Y como es Zurprais, 2 días antes sabrás lo que es.</p>
</div>
<div class="overlay1"></div>
</div>
<div class="col-sm-3 col-xs-12 factorImg2">
<div class="factorImgText">
<h6>PLANES CON UN PLUS</h6>
<p>Un atardecer en velero… ¿con cava y ostras? Un brunch… ¿entre viñedos? Todas tus experiencias tendrán un toque extra que las hará aún más especiales.</p>
</div>
<div class="overlay2"></div>
</div>
<div class="col-sm-3 col-xs-12 factorImg3">
<div class="factorImgText">
<h6>EMOCIÓN DESDE LA RESERVA</h6>
<p>Al reservar, empieza el juego. Recibirás algunas pistas sobre las actividades que te podrían tocar. Para que vayas calentando motores.</p>
</div>
<div class="overlay3"></div>
</div>
<div class="col-sm-3 col-xs-12 factorImg4">
<div class="factorImgText">
<h6>CAMBIO GRATUITO</h6>
<p>¡Segurísimo que tu plan te va a encantar! Pero para que estés tranquil#: si no te gusta lo que te hemos organizado, te preparamos uno diferente para otro día.</p>
</div>
<div class="overlay4"></div>
</div>
</div>
</div>
</div>

Related

CSS - Align Buttons in the same line

I would like to align these buttons in the same line. It looks like it is aligning itself according to the text, but I would like the buttons to be aligned according to the bottom of the card, so it would be independent of the length of the text. Thank you for any help. I have included the code snippet as well.
My outcome
Desired outcome
.container3 {
padding-top: 50px;
display: flex;
justify-content: center;
}
.box {
background-color: white;
opacity: 0.9;
width: 300px;
height:500px;
margin:20px;
box-sizing: border-box;
border-radius: 10px;
transition: transform 0.5s;
box-shadow: 2px 2px 20px grey;
cursor: pointer;
}
.box-image.img1 {
height:200px;
background-image: url(images/pamatky.jpg);
background-size:cover;
box-sizing: border-box;
border-radius: 10px;
margin: 10px;
}
.box-image.img2 {
height:200px;
background-image: url(images/pyramidy.jpg);
background-size:cover;
box-sizing: border-box;
border-radius: 10px;
margin: 10px;
}
.box-image.img3 {
height:200px;
background-image: url(images/chufe.jpg);
background-size:cover;
box-sizing: border-box;
border-radius: 10px;
margin: 10px;
}
.box-image.img4 {
height:200px;
background-image: url(images/rache.jpg);
background-size:cover;
box-sizing: border-box;
border-radius: 10px;
margin: 10px;
}
.box:hover {
transform: scale(1.1);
}
p.box-text {
color: black;
padding: 10px;
text-align: justify;
font-weight: 500;
}
h2 {
text-align: center;
font-weight: 900;
}
.button a {
background-color: white;
color: black;
font-size: 15px;
padding: 15px 20px;
display: block;
text-align:center;
margin: 0px 100px;
text-decoration: none;
cursor: pointer;
box-sizing: border-box;
border-radius: 10px;
box-shadow: 2px 2px 5px grey;
bottom: 2px;
}
<div id="container2">
<section class="container3">
<div class="box">
<div class="box-image img1"></div>
<h2>Památky</h2>
<p class="box-text">Egypt je země na památky velice bohatá. Pojedeme-li po Nilu od egyptských hranic na sever, můžeme se neustále nechávat okouzlovat novými a novými chrámy, sfingami, pyramidami … . Naše stránky se teprve rozjíždějí. Proto jsme zatím vybrali pouze nejnavštěvovanější památky. Samozřejmě budeme jejich počet průběžně rozšiřovat. Zatím jsou rozděleny do tří oblastí - okolí Káhiry (Gíza, Sakkara a Memfis), okolí Luxoru (starověké Théby neboli Veset) a jižní hranice Egypta (Asuán, Abú Simbel …). S rozšiřováním stránek budeme samozřejmě rozšiřovat i počet oblastí.</p>
<div class="button">VÍCE</div>
</div>
<div class="box">
<div class="box-image img2"></div>
<h2>Pyramidy</h2>
<p class="box-text">Tři velké jehlany se sfingou v popředí jsou snad nejčastěji používaným symbolem Egypta.Udivující je, že vznikly již v raném počátku egyptské civilizace a státnost, za vlády 4. dynastie. Tyto tři velké pyramidy v Gíze jsou sice nejznámější, avšak v žádném případě jediné. Po celém Egyptě je rozeseto množství méně známých, ale ne méně cenných pyramid. Že tyto monumentální stavby byly postaveny proto, aby chránily věčný spánek faraónů, ví dnes každé malé dítě. Již pět tisíciletí zaměstnávají mysl architektů, matematiků, archeologů, stavitelů, ale i vyznavačů méně exaktních směrů.</p>
<div class="button">VÍCE</div>
</div>
<div class="box">
<div class="box-image img3"></div>
<h2>Chufevova pyramida</h2>
<p class="box-text">Je známá pod jménem vládce, který ji nechal postavit, faraóna Chufeva, řecky Cheopse. Je to největší dodnes stojící pyramida a na dlouhá tisíciletí největší dílo lidských rukou vůbec. Do roku 1880 byla nejvyšší stavbou na světě, pak ji překonaly věže dómu v Kolíně nad Rýnem a v roce 1889 Eiffelova věž. Se čtvercovou základnou o straně 230 metrů a původní výškou 146 m si naše představivost asi těžko poradí. Fotbalovým fanouškům přiblížíme lépe její velikost, když řekneme, že na její základnu by se vešlo deset fotbalových hřišť.</p>
<div class="button">VÍCE</div>
</div>
<div class="box">
<div class="box-image img4"></div>
<h2>Rachefova pyramida</h2>
<p class="box-text">Známe ji též pod názvem Chefrenova pyramida. Po vzoru svého otce Chufeva si nechává stavět svoji hrobku i faraón Rachef. Tato pyramida, která je o deset metrů nižší, než byla původní výška Chufevovy pyramidy a o metr nižší než je dnes, působí daleko vyšším dojmem, protože je postavená na místě výše postaveném. Obě jsou však téměř stejně veliké. Rozdíl deseti metrů výšky a dvaceti metrů v jedné straně základny (Rachefova má základnu 210 x 210 m) už na výsledném monumentálním dojmu nic nebere.</p>
<div class="button">VÍCE</div>
</div>
</div>
</div>
</div>
You can try this :
.box {
position : relative;
}
.button {
position: absolute;
bottom: 10px;
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;
}
The idea is to make all the .box elements as flexbox containers with column direction and the last child elements (the .button container) should have margin-top: auto.
You could also improve the accessibility and maintainability of the content by placing the images as regular images elements (and not as backgrounds, since they convey information) using the object-fit property (as you can see I used 4 different images, but they cover the space keeping their aspect ratio.)
.container3 {
padding-top: 50px;
display: flex;
gap : 20px;
justify-content: center;
}
.container3 * {
box-sizing: border-box;
}
.box {
background-color: white;
opacity : 0.9;
width : 300px;
border-radius : 10px;
transition : transform 0.5s;
box-shadow : 2px 2px 20px grey;
cursor : pointer;
display : flex;
flex-direction: column;
}
.box figure {
display: block;
height: 200px;
margin: 10px;
padding: 0;
border-radius: inherit;
overflow: hidden;
}
.box img {
height: 100%;
width: 100%;
object-fit: cover;
object-position: center center;
}
.box:hover {
transform: scale(1.1);
}
p.box-text {
color: black;
padding: 10px;
text-align: justify;
font-weight: 500;
}
h2 {
text-align: center;
font-weight: 900;
}
.button {
margin-top: auto;
margin-bottom: 30px;
}
.button a {
background-color: white;
color: black;
font-size: 15px;
padding: 15px 20px;
display: block;
text-align:center;
margin: 0px 100px;
text-decoration: none;
cursor: pointer;
box-sizing: border-box;
border-radius: 10px;
box-shadow: 2px 2px 5px grey;
bottom: 2px;
}
<section class="container3">
<div class="box">
<figure><img src="http://via.placeholder.com/1000x200" /></figure>
<h2>Památky</h2>
<p class="box-text">Egypt je země na památky velice bohatá. Pojedeme-li po Nilu od egyptských hranic na sever, můžeme se neustále nechávat okouzlovat novými a novými chrámy, sfingami, pyramidami … . Naše stránky se teprve rozjíždějí. Proto jsme zatím vybrali pouze nejnavštěvovanější památky. Samozřejmě budeme jejich počet průběžně rozšiřovat. Zatím jsou rozděleny do tří oblastí - okolí Káhiry (Gíza, Sakkara a Memfis), okolí Luxoru (starověké Théby neboli Veset) a jižní hranice Egypta (Asuán, Abú Simbel …). S rozšiřováním stránek budeme samozřejmě rozšiřovat i počet oblastí.</p>
<div class="button">VÍCE</div>
</div>
<div class="box">
<figure><img src="http://via.placeholder.com/500x400" /></figure>
<h2>Pyramidy</h2>
<p class="box-text">Tři velké jehlany se sfingou v popředí jsou snad nejčastěji používaným symbolem Egypta.Udivující je, že vznikly již v raném počátku egyptské civilizace a státnost, za vlády 4. dynastie. Tyto tři velké pyramidy v Gíze jsou sice nejznámější, avšak v žádném případě jediné. Po celém Egyptě je rozeseto množství méně známých, ale ne méně cenných pyramid. Že tyto monumentální stavby byly postaveny proto, aby chránily věčný spánek faraónů, ví dnes každé malé dítě. Již pět tisíciletí zaměstnávají mysl architektů, matematiků, archeologů, stavitelů, ale i vyznavačů méně exaktních směrů.</p>
<div class="button">VÍCE</div>
</div>
<div class="box">
<figure><img src="http://via.placeholder.com/400x300" /></figure>
<h2>Chufevova pyramida</h2>
<p class="box-text">Je známá pod jménem vládce, který ji nechal postavit, faraóna Chufeva, řecky Cheopse. Je to největší dodnes stojící pyramida a na dlouhá tisíciletí největší dílo lidských rukou vůbec. Do roku 1880 byla nejvyšší stavbou na světě, pak ji překonaly věže dómu v Kolíně nad Rýnem a v roce 1889 Eiffelova věž. Se čtvercovou základnou o straně 230 metrů a původní výškou 146 m si naše představivost asi těžko poradí. Fotbalovým fanouškům přiblížíme lépe její velikost, když řekneme, že na její základnu by se vešlo deset fotbalových hřišť.</p>
<div class="button">VÍCE</div>
</div>
<div class="box">
<figure><img src="http://via.placeholder.com/500x300" /></figure>
<h2>Rachefova pyramida</h2>
<p class="box-text">Známe ji též pod názvem Chefrenova pyramida. Po vzoru svého otce Chufeva si nechává stavět svoji hrobku i faraón Rachef. Tato pyramida, která je o deset metrů nižší, než byla původní výška Chufevovy pyramidy a o metr nižší než je dnes, působí daleko vyšším dojmem, protože je postavená na místě výše postaveném. Obě jsou však téměř stejně veliké. Rozdíl deseti metrů výšky a dvaceti metrů v jedné straně základny (Rachefova má základnu 210 x 210 m) už na výsledném monumentálním dojmu nic nebere.</p>
<div class="button">VÍCE</div>
</div>
</section>
They react this way because they're dependent from the text's length. You can place the buttons in your .box with position: absolute.
Put them in a .container, give width: 100% to the .container, then text-align: center (so the button will remain centered) and the coordinates with position: absolute. Give left: 0 (so the .container remains centered) and the distance from the bottom you want. Obviously give position: relative to your .box and everything should works properly.

How to prevent text going over button

I have a box with an image at the right-side and text at the left-side. The box should have a white background. At smaller screens the text goes below the image which is good.
A few px above the bottom of the box I want to have a button.
Think I should do that by using position relative for the box and position absolute for the button.
The CSS and HTML code is
.box {
background: white;
float: right;
position: relative
}
.space {
padding: 15px;
}
.button {
vertical-align: middle;
position: absolute;
bottom: 40px;
margin-left: 15px;
}
<div class="box">
<img class="box" src="https://d2f0ora2gkri0g.cloudfront.net/e4/16/e4164876-1967-4303-9a57-aae00eb2b22b.png" alt="oproeien" style="margin-right:0px; margin-left:0px">
<h2 class="space">Amsterdam</h2>
<p class="space">Amsterdam is de (titulaire) hoofdstad en naar inwonertal de grooteeuw tot stadsuitbreidingen, waaronder de laatste grachten van de fortificatie die nu als grachtengordel bekend is en in 2010 is toegevoegd aan de UNESCO-Werelderfgoedlijst.</p>
<a class="button" href="https://www.buienradar.nl">Slecht weer</a>
<hr>
</div>
Problem is that on smaller screen the text is displayed over the button. Another issue is that padding of the text does not prevent it getting connected to image (laptop/desktop). I do not want to add margin-left to picture because I want the line <hr>to be connected to the image.
The button is over the text because you have used position:absolute to the button.
Set position:relative and bottom:auto in the smaller screen using media query rule...
Also using vertical-align: middle; in the absolute positioned elements will do nothing...so better to remove it
Stack Snippet
.box {
background: white;
float: right;
position: relative
}
.space {
padding: 15px;
}
img {
max-width: 100%;
}
.button {
position: absolute;
bottom: 40px;
margin-left: 15px;
}
#media (max-width:768px) {
.button {
position: relative;
bottom: auto;
margin-left: 15px;
}
}
<div class="box">
<img class="box" src="https://d2f0ora2gkri0g.cloudfront.net/e4/16/e4164876-1967-4303-9a57-aae00eb2b22b.png" alt="oproeien" style="margin-right:0px; margin-left:0px">
<h2 class="space">Amsterdam</h2>
<p class="space">Amsterdam is de (titulaire) hoofdstad en naar inwonertal de grooteeuw tot stadsuitbreidingen, waaronder de laatste grachten van de fortificatie die nu als grachtengordel bekend is en in 2010 is toegevoegd aan de UNESCO-Werelderfgoedlijst.</p>
<a class="button" href="https://www.buienradar.nl">Slecht weer</a>
<hr>
</div>

CSS Background becoming blurred besides a div

Well, I searched a lot and everything that I find didn't work for me, like a curse, what I'm tryng to do is blur a background image when the person that is viewing the web page see the div, I started to make this page a short time ago, as soon as I started to try to learn CSS and JavaScript, so, what I've done is this:
html:
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<title> BIRL </title>
</head>
<body>
<div class="bg-img">
<br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br>
<center><div class="botao"><img src="play.png" class="playButton"></div></center>
<br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br>
<div class="info">
<h1 class="titles">Quem nós Somos?</h1>
<a class="macaco">Nós somos uma empresa totalmente responsável e profisisonal inclinada a satisfação de nossa clientela
Nossos produtos sempre foram, são, e sempre serão destinados a nossos clientes, (salve ronildo)</a>
<h1 class="titles">Qual é a nossa missão na terra?</h1>
<a class="macaco">Nossa missão é proporcionar a melhor qualidade de entreterimento sadio para a sua família e amigos afins,
todos os nossos jogos possuem uma qualidade exemplar e classificação livre, ou seje, eles podem ser jogados por qualquer pessoa
em qualquer idade e qualquer lugar do mundo, nós nunca utilizaremos palavras de baixo calão em nossas obras eletrônicas, isto
é um exemplo para os seus filhos.</a>
</div>
</div>
</body>
</html>
css:
#font-face {
font-family: LemonMilk;
src: url(LemonMilk.otf);
}
.playButton {
width: 55%;
height: 40%;
z-index:2;
}
.game {
width: 100%;
height: 100%;
}
body {
background:url('background.jpg') no-repeat;
background-size: 100% 100%;
background-attachment: fixed;
}
.botao {
float: rigth;
width: 100%;
height: 100%;
vertical-align: middle;
z-index:2;
}
.info::before {
display: block;
width: 100%;
height: 100%;
background: url('background-blurred.jpg');
background-size: cover;
content: '';
opacity: 1;
}
.info {
background-color: #FFFFFF;
font-family: LemonMilk, Verdana, Tahoma;
padding: 70px;
text-align: justify;
}
.titles {
color: #000000;
text-align: center;
z-index: 1;
}
.macaco {
color: #000000;
}
I want to make something like this: http://jordanhollinger.com/media/bmu-landing.png
Here you go: How to apply a CSS 3 blur filter to a background image
Now, there is typo float: rigth. Also, there are a lot of unnecessary things in your code, but you are beginner. Keep practicing and everything will fall in its place eventually!
And, it is hard to decipher what you want exactly.
" what I'm tryng to do is blur a background image when the person that is viewing the web page see the div,"
Do you mean, when DIV with the picture is visible?

adding an <a> tag messes everything up

I want to add links for every box but whenever I try to add an "a" tag it messes everything up. What am I missing :-/ ? I have tried a lot of stuff and still can't figure out what wrong. Would appreciate your help.
Thanks
This is how it is supposed to look
http://oi66.tinypic.com/iykcc5.jpg
https://jsfiddle.net/983wga5c/7/
HTML
<div class="fwsmain">
<div class="fwsside side-text"><span>Tinutul Neamtului</span><p class="text">Pentru cei care au fost prima data, tinutul Neamtului a devenit locul in care te intorci cu bucurie. Platoul cu preparate moldovenesti de la Hanul Ancutei, drumetiile pe Ceahlau, fotografiile de la Barajul Bicaz, viata de noapte din Piatra Neamt, zimbrii, cetatea Neamtului, manastiri din top 10 din Romania, Muzeul de masti de la Tincabesti sau casa memoriala a lui Creanga, sunt doar cateva dintre atractiile memorabile din aceasta zona. Si ai cel putin cinci evenimente de traditie pe care nu trebuie sa le ratezi.</p></div>
<div class="fwsside">
<div class="fwsside-flex1">
<div class="fwsitem"><div class="hoverbg"><span>Case memoriale</span></div></div>
<div class="fwsitem"><div class="hoverbg"><span>Turnul lui Ștefan</span></div></div>
<div class="fwsitem"><div class="hoverbg"><span>Orașul de sus</span></div></div>
<div class="fwsitem"><div class="hoverbg"><span>Hai la ski</span></div></div>
<div class="fwsitem fullw"><div class="hoverbg"><span>Trebuie să vezi</span></div></div>
</div></div>
</div>
CSS
.fwsmain{
width: 100%;
display: flex;
flex-wrap: wrap;}
.fwsside {
height: 100%;
width: 50%;}
.side-text{
margin:auto;
padding:0 20px;}
.fwsside-flex1{
height: 100%;
width: 100%;
display:flex;
flex-shrink:1;
flex-grow:1;
flex-wrap:wrap;}
.fwsside-flex1 .fwsitem {
width:50%;
text-align: center;
background-size:cover;
}
.fullw{
width:100% !important;}
.hoverbg:hover {
background:rgba(0, 0, 0, 0.6);
}
.fwsside-flex1 .fwsitem:nth-child(1) {
background-image: url('http://descoperanordest.ro/wp-content/uploads/2016/01/calistrat-hogas.jpg');
}
.fwsside-flex1 .fwsitem:nth-child(2) {
background-image: url('http://descoperanordest.ro/wp-content/uploads/2016/01/clopotnita-turn-pnt.jpg');
}
.fwsside-flex1 .fwsitem:nth-child(3) {
background-image: url('http://descoperanordest.ro/wp-content/uploads/2016/01/telegondola.jpg');
}
.fwsside-flex1 .fwsitem:nth-child(4) {
background-image: url('http://descoperanordest.ro/wp-content/uploads/2016/01/ski.jpg');
}
.fwsside-flex1 .fwsitem:nth-child(5) {
background-image: url('http://descoperanordest.ro/wp-content/uploads/2016/01/cucuteni.jpg');
}
.fwsside-flex1 span {
line-height:33.3vh;
margin:auto;
font-size: 33px;
font-weight: bold;
color: #fff;}
It looks like you have to move your class="fwsitem" to your newly added <a> tags because they are now your flexbox container's (.fwsside-flex1) children.
Here is a updated fiddle.

Flexbox, absolute positioning and 100% height

I've run into a bit of a problem while playing around with a flexbox inside an absolute box, which is inside a defined height div (I'll explain along the way).
First off, here's a fiddle to my demo, might be easier to grasp the problem:
https://jsfiddle.net/8ub9tyub/
As you can see, when you hover the block, text appears from below but doesn't quite show fully.
I have a main div (let's call it $main) for the hover part which is 600x250px with an overflow: hidden, and inside it, two divs: title and text (say $title and $text), which appear after one another (regular flow).
$title can sometimes take up two lines, so its height is set to auto.
$text is set to 100% height, positioned in relative and set to display: flex. Inside that is another div ($intro) I positioned in absolute, with a top: 100% (which switches to 0 when hovered) and a align-self: flex-end in order to keep it at the bottom of $main. (this is to keep the text from being stuck to the title - I like it to breathe)
The structure goes like this, basically:
<div class="main">
<div class="title">I'm a title!</div>
<div class="text">
<div class="intro"><p>Just a bunch of long paragraphs of text</p></div>
</div>
</div>
Now, as you can see on my demo, $text's height is set to 100%, but I expected the height to be $main minus $title's heights, but here it seems to be just $main's height, which makes the $text block overflow, and so when I hover the block to make the text appear, it locks the bottom outside $main and cuts off part of the text.
Would anyone have a clue has to how I can make $text have the expected height, knowing I can't predict $title's height (and thus can't use calc(), at least as for as I know) and I don't want to use JavaScript in any way?
I've gone through and reworked the code without using any heights for the block text or the title text and only using Flex. If you use display: flex; only on the container that will contain the flexible items within it, then tell each item how to be flexible (ie. flex-grow: 1;), you'll get the result you're looking for. Here's a link to a fiddle I put together using your initial code and just reworking the code. Let me know if you have any questions or need clarification on anything.
body {
font-family: 'Bitter', Georgia, serif;
width: 673px;
}
a { color: #161616; text-decoration: none; }
* { box-sizing: border-box; }
.home_post_new * { transition: .5s all; }
.home_post_new {
background-position: right center;
background-repeat: no-repeat;
width: 100%;
height: 250px;
position: relative;
overflow: hidden;
margin-bottom: 20px;
}
.home_post_new_text {
float: right;
display: flex;
flex-direction: column;
width: 600px;
height: 100%;
background: hsla(0,0%,100%,0);
color: #fff;
position: relative;
}
.home_post_new:hover .home_post_new_text {
background: hsla(0,0%,0%,.33);
}
.home_post_new_block {
flex-grow: 2;
position: relative;
top: 250px;
width: 100%;
padding: 16px 16px 32px;
font-size: .9em;
line-height: 125%;
text-shadow: 0 1px 0 hsla(0,0%,0%,.75), 0 0 5px hsla(0,0%,0%,.75);
}
.home_post_new:hover .home_post_new_block {
top: 0;
}
.home_post_new_title {
flex-grow: 1;
font-family: 'Source Sans Pro', Arial, sans-serif;
font-size: 1.625em;
line-height: 1.333em;
width: 100%;
padding: 4px 8px 16px;
text-shadow: 0 1px 0 hsla(0,0%,0%,.75), 0 0 1px hsla(0,0%,0%,.75), 0 1px 5px hsla(0,0%,0%,.75);
background: -moz-linear-gradient(top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.65)), color-stop(100%,rgba(0,0,0,0)));
background: -webkit-linear-gradient(top, rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%);
background: -o-linear-gradient(top, rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%);
background: -ms-linear-gradient(top, rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%);
background: linear-gradient(to bottom, rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%);
}
.home_post_new_more {
position: absolute;
right: 0;
bottom: -50%;
padding: 4px 8px;
font-family: 'Source Sans Pro', Arial, sans-serif;
color: #fff;
text-shadow: 0 1px 0 hsla(0,0%,0%,.75), 0 0 5px hsla(0,0%,0%,.75);
border-style: solid;
border-width: 1px 0 0 1px;
border-color: currentColor;
border-radius: 0;
border-top-left-radius: 2px;
text-transform: uppercase;
letter-spacing: 1px;
background: hsla(0,0%,0%, .5);
}
.home_post_new_more:hover {
color: #009884;
cursor: pointer;
}
.home_post_new:hover .home_post_new_more {
bottom: 0;
}
.home_post_new_meta {
width: calc(100% - 600px);
height: 100%;
text-align: center;
color: #009884;
}
.home_post_new_date {
background: #009884;
color: #eee;
padding: 24px 0 0;
height: 50%;
}
.home_post_new_date_day {
font-size: 250%;
font-weight: bold;
}
.home_post_new_date_month {
font-family: 'Source Sans Pro', Arial, sans-serif;
text-transform: uppercase;
font-size: 150%;
border-top: 1px solid #eee;
display: inline-block;
margin-top: 8px;
padding-top: 4px;
}
.home_post_new_date_comments {
color: currentColor;
display: inline-block;
border-radius: 50%;
border-bottom-right-radius: 0;
width: 42px;
height: 42px;
margin-top: 32px;
padding: 12px 4px;
border: 1px solid currentColor;
margin-top: calc(50% - 4px);
}
.home_post_new_text:after {
clear: both;
overflow: auto;
zoom: 1;
}
<div class="home_post_new" style="background-image: url(http://geekometric.com/wp-content/uploads/2014/11/fetch_ifl.jpg);">
<a class="home_post_new_text" href="#">
<div class="home_post_new_title">[Test] inFAMOUS : First Light</div>
<div class="home_post_new_block">
<p>Après les aventures de Delsin, voici inFAMOUS : First Light, qui propose de jouer dans la peau d’un personnage secondaire de Second Son : Fetch. Une aventure qui est, à l’instar de Festival of Blood pour inFAMOUS 2, une extension ne nécessitant pas le jeu de base. Même ville, différents pouvoirs (enfin, pas vraiment), nouvelle histoire et un mode de jeu en plus… De quoi s’amuser un peu ! Mais qu’est-ce que ça vaut ? Voyons cela.</p>
</div>
</a>
<div class="home_post_new_more">Lire la suite →</div>
<div class="home_post_new_meta">
<div class="home_post_new_date" title="30 novembre 2014">
<div class="home_post_new_date_day">30</div>
<div class="home_post_new_date_month">NOV</div>
</div>
2
</div>
</div>
<div class="home_post_new" style="background-image: url(http://geekometric.com/wp-content/uploads/2014/11/monumentvalley.jpg);">
<a class="home_post_new_text" href="#">
<div class="home_post_new_title">[Test] Monument Valley</div>
<div class="home_post_new_block">
<p>Profitant d’un crédit de 3€ offert par Amazon sur leur App Shop, je me suis laissé tenter par Monument Valley, ayant entendu du bien du jeu et étant assez intrigué son style. Au pire, je ne perdais rien dans l’affaire… Après plusieurs courtes séances, j’ai terminé le jeu et j’ai donc pu forger un avis assez complet dessus, malgré le fait que Monument Valley soit un « petit jeu », mais il ne faut pas négliger son ambition et potentiel pour autant. </p>
</div>
</a>
<div class="home_post_new_more">Lire la suite →</div>
<div class="home_post_new_meta">
<div class="home_post_new_date" title="28 octobre 2014">
<div class="home_post_new_date_day">17</div>
<div class="home_post_new_date_month">NOV</div>
</div>
37
</div>
</div>
<div class="home_post_new" style="background-image: url(http://geekometric.com/wp-content/uploads/2014/11/interstellar.jpg);">
<a class="home_post_new_text" href="#">
<div class="home_post_new_title">[Séance ciné] Interstellar</div>
<div class="home_post_new_block">
<p>Alors comme ça le prochain long-métrage de Christopher Nolan est sorti ? La science-fiction, c’est mon truc, ça ! Je me suis évité tout spoiler possible sur ce film, cette critique en fera autant. J’ai eu le plaisir de voir Interstellar en IMAX, ma première séance dans ce format d’ailleurs, ce qui ne m’a pas déçu. Bon allez, on va voir tout ça, 3… 2… 1… décollage !</p>
</div>
</a>
<div class="home_post_new_more">Lire la suite →</div>
<div class="home_post_new_meta">
<div class="home_post_new_date" title="28 octobre 2014">
<div class="home_post_new_date_day">11</div>
<div class="home_post_new_date_month">NOV</div>
</div>
37
</div>
</div>
<div class="home_post_new" style="background-image: url(http://geekometric.com/wp-content/uploads/2014/11/johnwick.jpg);">
<a class="home_post_new_text" href="#">
<div class="home_post_new_title">[Séance ciné] John Wick</div>
<div class="home_post_new_block">
<p>Encore un film qui est sorti de nulle part pour moi, John Wick a attiré mon attention, notamment grâce à la présence de l’immortel Keanu Reeves sur l’affiche. Malgré la minuscule salle (vous savez, celle pour 40 personnes qu’on paie aussi cher que les énormes salles…), j’ai bien pu me mettre dans le film. Chargez vos fusils, on va voir ce que ça donne.</p>
</div>
</a>
<div class="home_post_new_more">Lire la suite →</div>
<div class="home_post_new_meta">
<div class="home_post_new_date" title="28 octobre 2014">
<div class="home_post_new_date_day">28</div>
<div class="home_post_new_date_month">OCT</div>
</div>
37
</div>
</div>
<div class="home_post_new" style="background-image: url(http://geekometric.com/wp-content/uploads/2013/12/tlou_goodies.jpg);">
<a class="home_post_new_text" href="#">
<div class="home_post_new_title">[Avis de passage] Goodies The Last of Us : Press Kit, figurine…</div>
<div class="home_post_new_block">
<p>Bon, c'est un arrivage qui date un peu, mais je tenais à vous présenter quelques goodies tirés de The Last of Us, non seulement parce que j'adore ce jeu mais parce que ces chouettes objets sont plutôt réussis, et étant donné qu'ils ne sont vus que par mes petits yeux, pourquoi ne pas vous en faire profiter un peu également ? Et ce n'est certainement pas un moyen de faire du contenu en attendant que je fasse mes tests de jeux PS4, je vous assure ! Bon j'ai pris un paquet de photos, c'est cadeau.</p>
</div>
</a>
<div class="home_post_new_more">Lire la suite →</div>
<div class="home_post_new_meta">
<div class="home_post_new_date" title="28 octobre 2014">
<div class="home_post_new_date_day">28</div>
<div class="home_post_new_date_month">OCT</div>
</div>
3
</div>
</div>
So let me get this straight you have:
<div class='main'>
<div class='title'>
<div class='text'></div>
</div>
</div>
And setting the height of div text to 100% sets it to the height of main even though it's inside div title. I think the problem might be that you did not specify the height of .title in your CSS. If you do not specify the height of the title div, then the text division will take on the height of the main div.
Again, just a guess but check for that.