Currently I'm working on a website which contains four rows. I'd like to center the container horizontally and vertically where horizontally centering is already done.
Can anyone help me, please? I already tried with "display: flex" but it still doesn't work.
I'm working with Twitter Bootstrap and Font Awesome.
https://jsfiddle.net/L9dbzgpr/
Code:
<div class="container text-center">
<div class="row">
<div class="col-sm-3"> <i class="fa fa-5x fa-desktop"></i>
</div>
<div class="col-sm-3"> <i class="fa fa-5x fa-music"></i>
</div>
<div class="col-sm-3"> <i class="fa fa-5x fa-cloud"></i>
</div>
<div class="col-sm-3"> <i class="fa fa-5x fa-cog"></i>
</div>
</div>
<div class="row margin-top">
<div class="col-sm-3"> <i class="fa fa-5x fa-youtube-play"></i>
</div>
<div class="col-sm-3"> <i class="fa fa-5x fa-facebook"></i>
</div>
<div class="col-sm-3"> <i class="fa fa-5x fa-soundcloud"></i>
</div>
<div class="col-sm-3"> <i class="fa fa-5x fa-google"></i>
</div>
</div>
<div class="row margin-top">
<div class="col-sm-3"> <i class="fa fa-5x fa-instagram"></i>
</div>
<div class="col-sm-3"> <i class="fa fa-5x fa-dropbox"></i>
</div>
<div class="col-sm-3"> <i class="fa fa-5x fa-twitter"></i>
</div>
<div class="col-sm-3"> <i class="fa fa-5x fa-cog"></i>
</div>
</div>
<div class="row margin-top">
<div class="col-sm-3"> <i class="fa fa-5x fa-cog"></i>
</div>
<div class="col-sm-3"> <i class="fa fa-5x fa-desktop"></i>
</div>
<div class="col-sm-3"> <i class="fa fa-5x fa-music"></i>
</div>
<div class="col-sm-3"> <i class="fa fa-5x fa-cloud"></i>
</div>
</div>
</div>
CSS:
#charset "UTF-8";
/********** General styles **********/
body {
font-size: 16px;
background: url('../media/images/banner.jpg') no-repeat center center fixed;
background-repeat: no-repeat;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
width: 100%;
height: 100%;
position: relative;
}
a, a:focus, a:active {
text-decoration: none;
color: #F9F9F9;
opacity: 0.7;
}
a>.fa:hover, a:hover {
-webkit-transition: all .5s ease;
transition: all .5s ease;
transform: scale(1.2);
opacity: 1;
}
.container {
margin: 0 auto; /* horizontally centered */
}
.margin-top {
margin-top: 3em;
}
Update of my solution:
HTML:
#charset "UTF-8";
/********** General styles **********/
html, body {
height: 100%;
margin: 0;
}
body {
font-size: 16px;
background: url('../media/images/banner.jpg') no-repeat center center fixed;
background-repeat: no-repeat;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
a, a:focus, a:active {
text-decoration: none;
color: #F9F9F9;
opacity: 0.7;
}
a>.fa:hover, a:hover {
-webkit-transition: all .5s ease;
transition: all .5s ease;
transform: scale(1.2);
opacity: 1;
}
.wrapper {
display: table;
height: 100%;
margin: 0 auto;
}
.wrapper-inner {
display: table-cell;
vertical-align: middle;
}
.margin-top {
margin-top: 3em;
}
.col-sm-3 {
padding-right: 4em;
padding-left: 4em;
}
CSS:
#charset "UTF-8";
/********** General styles **********/
html, body {
height: 100%;
margin: 0;
}
body {
font-size: 16px;
background-color: blue;
background-repeat: no-repeat;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
a, a:focus, a:active {
text-decoration: none;
color: #F9F9F9;
opacity: 0.7;
}
a>.fa:hover, a:hover {
-webkit-transition: all .5s ease;
transition: all .5s ease;
transform: scale(1.2);
opacity: 1;
}
.wrapper {
display: table;
height: 100%;
margin: 0 auto;
}
.wrapper-inner {
display: table-cell;
vertical-align: middle;
}
.margin-top {
margin-top: 3em;
}
.col-sm-3 {
padding-right: 4em;
padding-left: 4em;
}
Patrick F, Hi there.
Have a look at just using this to center both ways.
.center {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
In your code you use col-sm-3 I changed this to col-xs-3 to stop all the display items going 1 row vertical in small screens. Unless that is what you want to happen.
Resize the window and you will see what I mean.
Here is the Fiddle.
If you don't know the height and width of the container you could use this styling to center the element horizontally and vertically:
.container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
But I don't know if this has other unwanted effects.
Related
I want to center all items within the contacts class
.contacts {
width: 250px;
height: 500px;
margin-left: 37px;
margin-top: 50px;
position: relative;
background-color: aqua;
}
.contact-card {
position: absolute;
left: 0;
right: 0;
}
.contacts .contact-card img {
width: 225px;
height: 200px;
object-fit: cover;
}
<div className="contacts">
<div className="contact-card">
<img src="https://dummyimage.com/600x400/357f94/00ff04" />
<h3>Mr.Whiskerson</h3>
<div className="info-group">
<i className="fa-solid fa-phone"></i>
<p>(212) 555-1234</p>
</div>
<div className="info-group">
<i className="fa-solid fa-envelope"></i>
<p>MrWhiskerson.meow</p>
</div>
</div>
</div>
when I set as position left 0 and right 0 nothing is change how can I do this using position absolute
Just use Flexbox property (or Grid) to center elements.
I'll add in your code display:flex to the main container, and set justify-content: center; to center it's child horizontally (Jusitfy-content defines the alignment along the main axis).
.contacts {
width: 250px;
height: 500px;
margin-left: 37px;
margin-top: 50px;
position: relative;
background-color: aqua;
display:flex;/* add */
justify-content:center; /* add */
}
.contact-card {
/*position: absolute; remove
left: 0;
right: 0;*/
}
.contacts .contact-card img {
width: 225px;
height: 200px;
object-fit: cover;
}
<div class="contacts">
<div class="contact-card">
<img src="https://dummyimage.com/600x400/357f94/00ff04" />
<h3>Mr.Whiskerson</h3>
<div class="info-group">
<i class="fa-solid fa-phone"></i>
<p>(212) 555-1234</p>
</div>
<div class="info-group">
<i class="fa-solid fa-envelope"></i>
<p>MrWhiskerson.meow</p>
</div>
</div>
</div>
If you want to use position:absolute instead you can do this way
.contacts {
width: 250px;
height: 500px;
margin-left: 37px;
margin-top: 50px;
position: relative;
background-color: aqua;
}
.contact-card {
position: absolute;
left: 50%;
transform: translateX(-50%);
}
.contacts .contact-card img {
width: 225px;
height: 200px;
object-fit: cover;
}
<div class="contacts">
<div class="contact-card">
<img src="https://dummyimage.com/600x400/357f94/00ff04" />
<h3>Mr.Whiskerson</h3>
<div class="info-group">
<i class="fa-solid fa-phone"></i>
<p>(212) 555-1234</p>
</div>
<div class="info-group">
<i class="fa-solid fa-envelope"></i>
<p>MrWhiskerson.meow</p>
</div>
</div>
</div>
.img-wrap {
position: relative;
display: inline-block;
}
.img-wrap .close {
position: absolute;
top: 2px;
right: 2px;
z-index: 5;
transition: opacity 0.15s ease-in;
padding: 5px 2px 2px;
color: #000;
font-weight: bold;
cursor: pointer;
opacity: 0;
text-align: center;
font-size: 22px;
line-height: 10px;
border-radius: 50%;
}
.img-wrap:hover .close {
z-index: 10;
background-color: rgb(5 0 0 / 75%);
opacity: 1;
}
<div class="img-wrap">
<i class="fas fa-trash-alt fa-lg text-white"></i>
<div class="media">
<i class="fal fa-file fa-4x icon-pdf d-flex mr-3"></i>
<div class="media-body">
<h6 class="mt-0 mb-0 grey-text font-weight-bold">This is an existing File</h6>
<div><small><b class="mr-2">File Name</b>
${filename}
</small>
</div>
</div>
</div>
</div>
☝️This is what I want to display, but ended up like this👇
This works for the image but not for div with text
Just need to mask the background on hover. Got stuck over this.
If i understand your problem you can use a div (i called it layer) absolute positioned above the card and show it when you hover the card.
.img-wrap {
position: relative;
display: inline-block;
width:200px;/* not important */
height:200px;/* not important */
background:#aeaeae;/* not important */
}
.img-wrap .close {
position: absolute;
top: 2px;
right: 2px;
z-index: 5;
transition: opacity 0.15s ease-in;
padding: 5px 2px 2px;
color: #000;
font-weight: bold;
cursor: pointer;
opacity: 0;
text-align: center;
font-size: 22px;
line-height: 10px;
border-radius: 50%;
}
.img-wrap:hover .close {
z-index: 10;
background-color: rgb(5 0 0 / 75%);
opacity: 1;
}
/* add this */
.layer{
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
z-index:2;
background:rgba(255,255,255,0.9);
display:none;
}
.img-wrap:hover .layer{
display:block;
}
<div class="img-wrap">
<i class="fas fa-trash-alt fa-lg text-white"> x </i>
<div class="layer"> </div>
<div class="media">
<i class="fal fa-file fa-4x icon-pdf d-flex mr-3"></i>
<div class="media-body">
<h6 class="mt-0 mb-0 grey-text font-weight-bold">This is an existing File</h6>
<div><small><b class="mr-2">File Name</b>
${filename}
</small>
</div>
</div>
</div>
</div>
I have an absolute slider div including images and some arrows, When I add another div, I expect it appear after last div (that is absolute), but it places behind absolute div, I know it's because absolute position is beyond box flow, and I just want to know how to put new div after last absolute div, widout giving margin-top?
HTML code:
<div id="next">
<i class="fa fa-5x fa-angle-right" aria-hidden="true"></i>
</div>
<div id="slider">
<div class="slide">
<img src="images/1.jpg" alt="">
</div>
<div class="slide">
<img src="images/2.jpg" alt="">
</div>
<div class="slide">
<img src="images/3.jpg" alt="">
</div>
</div>
<div id="prev">
<i class="fa fa-5x fa-angle-left" aria-hidden="true"></i>
</div>
<div id="advertises">
</div>
Css code:
#slider{
position: relative;
margin-top: -17px;
}
.slide{
position: absolute;
width: 100%;
height: 400px;
}
.slide img{
width: 100%;
height: 400px;
}
#next, #prev{
width: 70px;
margin-top: 150px;
cursor: pointer;
position: relative;
z-index: 100;
background-color: rgba(255, 255, 255, .5);
display: flex;
justify-content: center;
border-radius: 50%;
}
#next{
margin-right: 25px;
float: right;
}
#prev{
margin-left: 25px;
float: left;
}
#advertises{
width: 50%;
height: 300px;
border: 1px solid #101010;
display: flex;
}
Jsfiddle
When you use absolute positioning you lose the ability to relate that to other elements. That is, you can place a element relatively to other when the other is absolute.
You should try to look for another solution that fits your intention. I don't see the reason to not use a "normal" positioning.
One way is to wrap the slider, then add overflow:auto and height:400px
.wrapper {
overflow: auto;
height: 400px;
}
#slider {
position: relative;
margin-top: -17px;
}
.slide {
position: absolute;
width: 100%;
height: 400px;
}
.slide img {
width: 100%;
height: 400px;
}
#next,
#prev {
width: 70px;
margin-top: 150px;
cursor: pointer;
position: relative;
z-index: 100;
background-color: rgba(255, 255, 255, .5);
display: flex;
justify-content: center;
border-radius: 50%;
}
#next {
margin-right: 25px;
float: right;
}
#prev {
margin-left: 25px;
float: left;
}
#advertises {
clear: both;
width: 50%;
height: 300px;
border: 1px solid #101010;
display: flex;
}
<div class="wrapper">
<div id="next">
<i class="fa fa-5x fa-angle-right" aria-hidden="true"></i>
</div>
<div id="slider">
<div class="slide">
<img src="images/1.jpg" alt="">
</div>
<div class="slide">
<img src="images/2.jpg" alt="">
</div>
<div class="slide">
<img src="images/3.jpg" alt="">
</div>
</div>
<div id="prev">
<i class="fa fa-5x fa-angle-left" aria-hidden="true"></i>
</div>
</div>
<div id="advertises">
</div>
So I would like to cover the whole thumbnail when hovering over, so that the overlay content fills the whole image, 100% by 100%. So the overlay should cover only image(whole size of it), not more than that.
Here's the pen to demonstrate the current state: http://codepen.io/anon/pen/JbJgoe
.about__images {
max-width: 800px;
margin: 0 auto;
}
.about__inner {
margin-top: 60px;
}
.about__inner img {
max-width: 100%;
margin-right: 20px;
}
.about .about__inner {
position: relative;
overflow: hidden;
}
.about .about__inner .about__inner--overlay {
background: rgba(0, 0, 0, .75);
text-align: center;
padding: 45px 0 66px 0;
opacity: 0;
transition: opacity .25s ease;
}
.about .about__inner:hover .about__inner--overlay {
opacity: 1;
}
<div class="container about">
<div class="about__images">
<div class="row">
<div class="about__inner col-md-4">
<img src="https://placeholdit.imgix.net/~text?txtsize=38&txt=400%C3%97300&w=400&h=300" alt="" class="hideonhover">
<div class="about__inner--overlay">
<i class="fa fa-user" aria-hidden="true"></i>
<p>lorem</p>
</div>
</div>
<div class="about__inner col-md-4">
<img src="https://placeholdit.imgix.net/~text?txtsize=38&txt=400%C3%97300&w=400&h=300" alt="">
<div class="about__inner--overlay">
<i class="fa fa-user" aria-hidden="true"></i>
<p>lorem</p>
</div>
</div>
<div class="about__inner col-md-4">
<img src="https://placeholdit.imgix.net/~text?txtsize=38&txt=400%C3%97300&w=400&h=300" alt="">
<div class="about__inner--overlay">
<i class="fa fa-user" aria-hidden="true"></i>
<p>lorem</p>
</div>
</div>
</div>
</div>
</div>
You are close to it. Just a small modification in structure and a few lines in css:
HTML:
<div class="col-md-4">
<div class="about__inner">
<img src="https://placeholdit.imgix.net/~text?txtsize=38&txt=400%C3%97300&w=400&h=300" alt="" class="hideonhover">
<div class="about__inner--overlay">
<i class="fa fa-user" aria-hidden="true"></i>
<p>lorem</p>
</div>
</div>
CSS:
.about .about__inner .about__inner--overlay {
background: rgba(0, 0, 0, .75);
text-align: center;
padding: 45px 0 66px 0;
opacity: 0;
transition: opacity .25s ease;
position: absolute;
top:0;
width:100%;
height:100%;
}
.about__inner{
position:relative;
}
.about__inner--overlay{
color:#fff;
}
Codepen: http://codepen.io/swapnaranjitanayak/pen/oYwKLO
You need to use absolute positionning and size the box. You may use coordonates to size the box so it fits any size since you already set the parent in relative positionning..
.about .about__inner .about__inner--overlay {
background: rgba(0, 0, 0, .75);
text-align: center;
padding: 45px 0 66px 0;
opacity: 0;
transition: opacity .25s ease;
top:0;
left:15px;
right:15px;
bottom:0;
color:white;
position:absolute
}
.about__images {
max-width: 800px;
margin: 0 auto;
}
.about__inner {
margin-top: 60px;
}
.about__inner img {
max-width: 100%;
padding-right: 20px;
}
.about .about__inner {
position: relative;
overflow: hidden;
}
.about .about__inner .about__inner--overlay {
background: rgba(0, 0, 0, .75);
text-align: center;
padding: 45px 0 66px 0;
opacity: 0;
transition: opacity .25s ease;
top:0;
left:15px;
right:35px;
bottom:0;
color:white;
position:absolute
}
.about .about__inner:hover .about__inner--overlay {
opacity: 1;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="container about">
<div class="about__images">
<div class="row">
<div class="about__inner col-md-4">
<img src="https://placeholdit.imgix.net/~text?txtsize=38&txt=400%C3%97300&w=400&h=300" alt="" class="hideonhover">
<div class="about__inner--overlay">
<i class="fa fa-user" aria-hidden="true"></i>
<p>lorem</p>
</div>
</div>
<div class="about__inner col-md-4">
<img src="https://placeholdit.imgix.net/~text?txtsize=38&txt=400%C3%97300&w=400&h=300" alt="">
<div class="about__inner--overlay">
<i class="fa fa-user" aria-hidden="true"></i>
<p>lorem</p>
</div>
</div>
<div class="about__inner col-md-4">
<img src="https://placeholdit.imgix.net/~text?txtsize=38&txt=400%C3%97300&w=400&h=300" alt="">
<div class="about__inner--overlay">
<i class="fa fa-user" aria-hidden="true"></i>
<p>lorem</p>
</div>
</div>
</div>
</div>
</div>
Try this:
.about__inner {
padding: 0px; //for full frame image
}
.about__inner img {
max-width: 100%;
max-height: 100%;
object-fit: cover; //force image display as cover, no scale
}
.about .about__inner .about__inner--overlay {
position: absolute; //You need it to arrange the div.
top: 0px;
left:0px;
width: 100%;
height: 100%;
}
Try this:
.about__images {
max-width: 800px;
margin: 0 auto;
}
.about__inner {
margin-top: 60px;
}
.about__inner img {
max-width: 100%;
margin-right: 20px;
}
.about .about__inner {
position: relative;
overflow: hidden;
}
.about .about__inner .about__inner--overlay {
background: rgba(0, 0, 0, .75);
text-align: center;
padding: 45px 0 66px 0;
opacity: 0;
transition: opacity .25s ease;
}
.about .about__inner:hover .about__inner--overlay {
opacity: 1;
position: relative;
height: 185px;
top: -185px;
}
I'm trying to display rotated text whereby its always absolute positioned to the bottom of its parent. The parent is 100% height of the browser window and I'd like the text to appear 50px from the bottom for all browser/screen sizes.
Here's my code:
html,body,.carousel,.carousel a.item { height: 100%; }
.carousel a.item {
height: 100%;
padding-top: 100px;
position: relative;
overflow: hidden;
width: 25%;
float: left;
}
.rotate {
zoom: 1;
white-space: nowrap;
position: absolute;
bottom: 0;
right: 0;
z-index: 3;
display: block;
width: 100%;
background: pink;
-webkit-transform-origin: right bottom;
-moz-transform-origin: right bottom;
-o-transform-origin: right bottom;
-ms-transform-origin: right bottom;
transform-origin: right bottom;
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
transform: rotate(-90deg);
}
.carousel a.item h1 {
color: #fff;
position: absolute;
right: 0;
bottom: 0;
height: 100%;
width: 100%;
background: blue;
z-index: 5;
display: block;
}
.bg-image {
background-repeat: no-repeat;
background-position: center center;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
<div class="carousel">
<a href="#" class="item bg-image" style="background-image: url('https://placeholdit.imgix.net/~text?txtsize=33&txt=300%C3%97800&w=300&h=800');">
<div class="rotate">
<h1>Some really long title thats quite long. Did I say it was long?</h1>
</div>
</a>
<a href="#" class="item bg-image" style="background-image: url('http://www.freelargeimages.com/wp-content/uploads/2014/12/Landscape_01.jpg');">
<div class="rotate">
<h1>This is really short</h1>
</div>
</a>
<a href="#" class="item bg-image" style="background-image: url('https://placeholdit.imgix.net/~text?txtsize=33&txt=300%C3%97800&w=300&h=800');">
<div class="rotate">
<h1>Short but also longer but not to long</h1>
</div>
</a>
<a href="#" class="item bg-image" style="background-image: url('http://www.freelargeimages.com/wp-content/uploads/2014/12/Landscape_01.jpg');">
<div class="rotate">
<h1>Some really long title thats quite long. Did I say it was long?</h1>
</div>
</a>
</div>
I have a fiddle setup of my code so far: https://jsfiddle.net/77xzfsfa/ and here's an image of what I'm trying to achieve:
You don't need to absolutely position the content of the rotated element.
Just adjust the transforms and transform origin.
.rotate{
zoom: 1;
white-space: nowrap;
position: absolute;
z-index: 3;
display: inline-block;
position: absolute;
right: 0;
bottom: 50px;
transform:translate(100%,0%) rotate(-90deg);
transform-origin:bottom left;
}
.carousel a.item h1 {
color: #fff;
z-index: 5;
}
* {
margin: 0;
}
html,
body,
.carousel,
.carousel a.item {
height: 100%;
}
.carousel a.item {
height: 100%;
padding-top: 100px;
position: relative;
overflow: hidden;
width: 25%;
float: left;
}
.rotate {
zoom: 1;
white-space: nowrap;
position: absolute;
z-index: 3;
display: inline-block;
position: absolute;
right: 0;
bottom: 50px;
transform: translate(100%, 0%) rotate(-90deg);
transform-origin: bottom left;
}
.carousel a.item h1 {
color: #fff;
z-index: 5;
}
.bg-image {
background-repeat: no-repeat;
background-position: center center;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
<div class="carousel">
<a href="#" class="item bg-image" style="background-image: url('https://placeholdit.imgix.net/~text?txtsize=33&txt=300%C3%97800&w=300&h=800');">
<div class="rotate">
<h1>Some really long title thats quite long. Did I say it was long?</h1>
</div>
</a>
<a href="#" class="item bg-image" style="background-image: url('http://www.freelargeimages.com/wp-content/uploads/2014/12/Landscape_01.jpg');">
<div class="rotate">
<h1>This is really short</h1>
</div>
</a>
<a href="#" class="item bg-image" style="background-image: url('https://placeholdit.imgix.net/~text?txtsize=33&txt=300%C3%97800&w=300&h=800');">
<div class="rotate">
<h1>Short but also longer but not to long</h1>
</div>
</a>
<a href="#" class="item bg-image" style="background-image: url('http://www.freelargeimages.com/wp-content/uploads/2014/12/Landscape_01.jpg');">
<div class="rotate">
<h1>Some really long title thats quite long. Did I say it was long?</h1>
</div>
</a>
</div>
You need to tweak the transform-origin and the positioning of the .rotate element like this :
html,body,.carousel,.carousel a.item { height: 100%; }
.carousel a.item {
height: 100%;
padding-top: 100px;
position: relative;
overflow: hidden;
width: 25%;
float: left;
}
.rotate {
white-space: nowrap;
position: absolute;
bottom: 50px;
left: 100%;
transform-origin: left bottom;
transform: rotate(-90deg);
}
.carousel a.item h1 {
color: #fff;
}
.bg-image {
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
}
<div class="carousel">
<a href="#" class="item bg-image" style="background-image: url('https://placeholdit.imgix.net/~text?txtsize=33&txt=300%C3%97800&w=300&h=800');">
<div class="rotate"><h1>Some really long title thats quite long. Did I say it was long?</h1></div>
</a>
<a href="#" class="item bg-image" style="background-image: url('http://www.freelargeimages.com/wp-content/uploads/2014/12/Landscape_01.jpg');">
<div class="rotate"><h1>This is really short</h1></div>
</a>
<a href="#" class="item bg-image" style="background-image: url('https://placeholdit.imgix.net/~text?txtsize=33&txt=300%C3%97800&w=300&h=800');">
<div class="rotate"><h1>Short but also longer but not to long</h1></div>
</a>
<a href="#" class="item bg-image" style="background-image: url('http://www.freelargeimages.com/wp-content/uploads/2014/12/Landscape_01.jpg');">
<div class="rotate"><h1>Some really long title thats quite long. Did I say it was long?</h1></div>
</a>
</div>
Note that I removed all the vendor prefixes in the snippet for answer brievity and removed unecessary CSS.
when you do put rotate: -90px
the real bottom is the left
the real right is the bottom
then we can say:
bottom -> right
right -> top
top -> left
left -> bottom
but when you put here
left: 0px;
it does not really 0px;
because on calculate from the center of div in horizontal position
for you code it will be correctly
like this
.carousel a.item h1 {
color: #fff;
font-size: 15px;
font-weight: 400;
position: absolute; bottom:10px; left: 150px;
height: 100%;
width: 100%;
background: blue;
z-index: 5;
display: block;
}
Try this, simply put the <br> in the code:
<div class="rotate">
<h1>Short but also longer but not to long</h1>
<br>
</div>