i am trying to make a google review section in contact card in which i have a google logo icon and a text element ( google review ) and font awesome 5 stars. I want all this to align vertically straight. But since i gave col-2 class all these are getting wrap to next line. I will attach the desired output image.
.row {
height: 400px;
background-color: grey;
}
.col-2 {
background-color: yellow;
}
/* google-review */
.google-review {
transform: rotate(90deg);
transform-origin: top left;
top:0;
background-color: #88206d;
overflow: visible;
}
.g-logo img {
transform: rotate(-90deg);
width: 38px;
background-color: #fff;
padding: 5px;
border-radius: 22px;
box-shadow: 2px 2px 6px 0px rgba(0, 0, 0, 0.53);
-webkit-box-shadow: 2px 2px 6px 0px rgba(0, 0, 0, 0.53);
-moz-box-shadow: 2px 2px 6px 0px rgba(0, 0, 0, 0.53);
}
.stars {
background: -webkit-linear-gradient(#FF3D00, #FFCE31);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css'>
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/[email protected]/slick/slick.css'>
<link rel='stylesheet' href='https://cdn.jsdelivr.net/gh/kenwheeler/[email protected]/slick/slick-theme.css'>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="./style.css">
<div class="container">
<div class="row">
<div class="col-5">
</div>
<div class="col-2 position-relative">
<div class="google-review position-absolute text-light px-4 py-2">
<div class="gtext-review"><span class="g-logo pr-3"><img src="https://i.ibb.co/PwTGZkb/search.png"></span>Google Review <span class="stars"><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i></span></div>
</div>
</div>
<div class="col-5">
</div>
</div>
</div>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/js/bootstrap.min.js'></script>
<script src='https://cdn.jsdelivr.net/npm/[email protected]/slick/slick.min.js'></script>
<script src="./script.js"></script>
2
Answers
Based on your desired output, here is the code to achieve this.
You can do most of the things without writing custom CSS because bootstrap covers most of the CSS classes to simplify our effort.
If I understood incorrectly, let me know in the comments.
Just set the
width
of thegoogle-review
div to400px
. Here is the working snippet: