I am creating a landing page for my site and would like one of those Jumbotrons to give it a modern and techy feel. I have managed to centre (horizontally and vertically) my text and I am now moving onto the background image. I have come across a problem though as I need the Div to be the height of my background image while the text still being in the centre. Here is my HTML
<div class="jumbo">
<div class="jumboCon">
<h1 class="centre">Kraft, unique</h1>
<p>The best present is a special one</p>
<div class="action">
<p>Search!</p>
</div>
</div>
</div>
And here is my CSS
.jumbo {
width: 100%;
background-image: url(../img/kraft.png);
}
.jumboCon {
width: 50%;
margin: auto;
position: relative;
top: 50%;
transform: translateY(-50%);
color: #fcfcfc;
}
I have read a couple of questions and answers, this one and they recommend just putting the image in the Div but I can't do that as I have text that needs to be centred there as well. Too make it even harder I will not always know the dimensions of the image as this will be were people promote their own pictures.
I would like this kind of effect as seen here on Ghost. I am not very talented with JavaScript but can probably copy and paste! Thanks
Nick