Bootstrap4 not responsive - html
html, body {
background-color: #E3E3E3;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
/* HOME */
.section1 {
background: url("../images/laptop-table1920-gray.jpg") no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-size: cover;
background-attachment: scroll;
width: 100%;
height: 100%;
}
.section1 .container {
background-color: rgb(0, 0, 0, 0.65);
min-height: -webkit-fill-available;
min-width: -webkit-fill-available;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
.home-btn {
background-color: transparent;
font-weight: 500;
border-color: #8e0000;
border-radius: 3px;
color: #8e0000;
margin-top: 35px;
font-size: 1.12em;
transform:translate(-50%, -50%);
position: absolute;
text-shadow: .1px .8px 1px black;
-webkit-filter: drop-shadow(0px 3px 10px rgba(0,0,0,.8));
filter: drop-shadow(0px 0px 2px rgba(0,0,0,.8));
}
/* hover styling required !important */
.home-btn:hover {
color: #8e0000 !important;
border-color: #8e0000;
font-size: 1.4em;
border-width: 3px;
font-weight: 600;
text-shadow: .1px 2px 1px black;
-webkit-filter: drop-shadow(0px 3px 10px rgba(0,0,0,.8));
filter: drop-shadow(0px 0px 2px rgba(0,0,0,.8));
}
.intro {
color: white;
font-size: 2.74em;
text-shadow: .1px .8px 1px black;
}
.highlight {
color: #8e0000;
text-shadow: .1px .8px 1px black;
}
/* NAVIGATION */
#navbar {
}
.logo{
display: inline-flex;
flex-direction: row;
-webkit-filter: drop-shadow(0px 3px 10px rgba(0,0,0,.8));
filter: drop-shadow(0px 0px 2px rgba(0,0,0,.8));
}
.navbar-brand {
margin: 0px;
padding: 0px 0px !important;
}
#navbar .nav-link:focus {
color: #8e0000;
text-size-adjust: 1.4em;
}
.logo-wrapper {
color: white;
font-size: 1.4em;
font-family: 'Raleway', sans-serif;
text-shadow: .1px 2px 1px black;
}
.logo-spin{
-webkit-animation: spin 1s ;
animation: spin 3s ;
animation-iteration-count: 1;
}
#-webkit-keyframes spin{
0% {
-webkit-transform: rotateY(360deg);
}
100% {
-webkit-transform: rotateY(-360deg);
}
}
#keyframes spin{
from {
-moz-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
transform: rotateY(0deg);
}
to {
-moz-transform: rotateY(-360deg);
-ms-transform: rotateY(-360deg);
transform: rotateY(-360deg);
}
}
.navbar {
background-color: #333;
height: 65px;
border-bottom: 6px solid #212529;
border-top: 6px solid #212529;
}
#navbar {
z-index: 9999;
}
.navbar-text {
vertical-align: middle;
margin-left: 200px;
height: inherit;
}
#media only screen and (max-width: 860px) {
.navbar-text {
display: inline-block;
align-items: center;
margin-left: 30px;
}
}
#navbar a {
float: left;
color: #f2f2f2;
text-align: center;
padding: 0px 20px;
text-decoration: none;
font-size: 1.2em;
font-family: 'Raleway', sans-serif;
text-shadow: .1px 1px 1px black;
/* margin-left: 40px; */
}
/* ABOUT */
#about {
overflow: hidden;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-size: cover;
width: 100%;
height: 100%;
text-shadow: .1px .8px 1px black;
position: relative;
height: -65px;
margin-top: 250px;
}
.section2 .row{
background: url("../images/improved-teamwork-and-collaboration_1887x741.jpg") center center no-repeat;
height: 100%;
width: 100%;
margin-left: 0px;
margin-right: 0px;
border-radius: 3px;
z-index: 1;
}
.section2 .card {
background-color: RGBA(33,37,41,.80);
color: white;
min-height: -webkit-fill-available;
height: 100%;
z-index: 2;
}
.section2 a {
color: #9b0000;
-webkit-filter: drop-shadow(.1px .8px 2px rgba(0,0,0, 0.8));
filter: drop-shadow(0px 0px 2px rgba(0,0,0, 0.8));
}
.section2 .card-block {
z-index: 3;
font-weight: 520;
width: 50%;
font-size: 25px;
line-height: 50px;
padding: 60px;
padding-right: 200px;
padding-left: 0px;
margin-left: 100px;
}
.section2 a:hover,
.section2 #skills:hover,
.section2 #projects:hover {
text-decoration: underline;
}
.section2 .btn {
border-color: #8e0000;
border-radius: 13px;
border-width: 3px;
font-weight: 500;
font-size: 0.8em;
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,
border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.section2 .btn:hover {
background-color: #8e0000;
color: #212529;
text-decoration: none;
}
#about {
margin-bottom: 0px;
}
/* SKILLS */
#skills {
margin-bottom: 50px;
margin-top: 20px;
}
#skills .code-icon {
margin-top: 10px;
margin-bottom: 15px;
}
#skills .col {
letter-spacing: .6px;
}
#skills .container{
border-style: solid;
border-width: 3px;
z-index: 0;
color: #d4d4dc;
background-color: #1d1e22;
border-color: black;
border-radius: .5%;
line-height: 2.4em;
font-size: 1.4em;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-size: cover;
padding-top: 5%;
padding-bottom: 5%;
}
#skills ul {
list-style: none;
}
/* PROJECTS */
#projects {
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;
margin-top: 70px;
margin-bottom: 50px;
}
#projects .row h1,
#projects .row .works-description {
text-shadow: .08px .5px black;
}
#projects .text-center {
max-width: 500px;
margin-bottom: 30px;
border-radius: 3px;
min-width: 300px;
box-shadow: 0 2px 8px 2px rgb(0, 0, 0);
padding: 15px;
background: #81888373;
text-shadow: .08px .5px black;
}
.works-description a {
color: #8e0000;
line-height: 36px;
margin-bottom: 36px;
width: 90%;
max-width: 1000px;
text-align: center;
margin-left: auto;
margin-right: auto;
}
.works-description {
line-height: 36px;
margin-bottom: 36px;
width: 90%;
max-width: 1000px;
text-align: center;
margin-left: auto;
margin-right: auto;
}
#projects .card-image-container {
width: 95%;
max-width: 420px;
max-height: 300px;
margin: 18px auto;
border-radius: 3px;
border: .5px solid #8e0000;
}
#projects .card-image-container
{
position:relative;
-webkit-box-shadow:0 1px 5px rgba(0,0,0,0.8), 0 0 5px rgba(0,0,0,0.8);
-moz-box-shadow:0 1px 5px rgba(0,0,0,0.8), 0 0 5px rgba(0,0,0,0.8);
box-shadow:0 1px 5px rgba(0,0,0,0.8), 0 0 8px rgba(0,0,0,0.8);
}
#projects .card-image-container:before, #projects .card-image-container:after
{
content:"";
position:absolute;
z-index:-1;
-webkit-box-shadow:0 0 20px rgba(0,0,0,0.8);
-moz-box-shadow:0 0 20px rgba(0,0,0,0.8);
box-shadow:0 0 20px rgba(0,0,0,0.8);
top:10px;
bottom:10px;
left:0;
right:0;
-moz-border-radius:100px / 10px;
border-radius: 100px / 10px;
}
#projects .card-image-container:after
{
right:10px;
left:auto;
-webkit-transform:skew(8deg) rotate(3deg);
-moz-transform:skew(8deg) rotate(3deg);
-ms-transform:skew(8deg) rotate(3deg);
-o-transform:skew(8deg) rotate(3deg);
transform:skew(8deg) rotate(3deg);
}
#media only screen and (max-width: 767px) {
#projects .card-image-container {
border-style: none;
box-shadow: none;
}
}
#projects img {
align-items: center;
justify-content: center;
max-width: 100%;
max-height: 100%;
}
#media only screen and (max-width: 992px) {
#projects img{
width: 200px;
}
}
#media only screen and (max-width: 408px) {
#projects img {
width: 150px;
}
}
#projects .card-body {
padding: 0 1.25rem;
margin-bottom: 18px;
}
#projects .summary {
color: #8e0000;
}
#projects .card-summary {
font-size: 18px;
margin-bottom: 18px;
line-height: 36px;
}
#media only screen and (min-width: 992px) {
#projects .card-summary {
height: 180px;
}
}
#media only screen and (min-width: 768px) {
#projects .card-summary {
height: 150px;
}
}
/*FOR BUTTONS GO HERE: *https://bootsnipp.com/snippets/Gl29g*/
/* background: -webkit-linear-gradient(to right, #212529, #8e0000); /* Chrome 10-25, Safari 5.1-6 */
/*background: linear-gradient(to right,#212529, #8e0000); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
/*font-size: 1.1rem; */
#projects .btn-rounded {
border-radius: 2px;
}
.btn-dark-moon {
background: #212529; /* fallback for old browsers */
color: rgba(255, 255, 255, 0.747);
border: 2px solid #eee;
position: relative;
text-shadow: .1px .8px 1px black;
-webkit-filter: drop-shadow(0px 3px 10px #8e0000);
filter: drop-shadow(0px 0px 2px #8e0000);
margin-right: 5px;
}
.btn-dark-moon:hover {
color: white;
border-width: 2.2px;
text-shadow: .1px 2px 1px black;
-webkit-filter: drop-shadow(0px 3px 10px #8e0000);
filter: drop-shadow(0px 0px 2px #8e0000);
}
.btn-darker-moon {
background: #212529; /* fallback for old browsers */
color: rgba(255, 255, 255, 0.747);
border: 2px solid #eee;
position: relative;
text-shadow: .1px .8px 1px black;
-webkit-filter: drop-shadow(0px 3px 10px #8e0000);
filter: drop-shadow(0px 0px 2px #8e0000);
margin-right: 5px;
}
.btn-darker-moon:hover {
color: white;
border-width: 2.2px;
text-shadow: .1px 2px 1px black;
-webkit-filter: drop-shadow(0px 3px 10px #8e0000);
filter: drop-shadow(0px 0px 2px #8e0000);
}
/*TESTIMONIALS*/
.testimonials {
margin: 50px auto;
color: #777;
margin-top: 115px;
margin-bottom: 100px;
text-shadow: .08px .5px black;
}
.testimonials h1 {
text-align: center;
font-weight: bold;
color: #8e0000;
padding-bottom: 10px;
text-transform: uppercase;
}
.testimonials .sayings {
font-size: 1.2em;
}
.testimonials h1::after {
content: '';
background: #8e0000;
display: block;
height: 3px;
width: 170px;
margin: 20px auto 5px;
}
.testimonials .row {
margin-top: 30px;
}
.col-md-4 {
margin: 40px auto;
}
.profile {
padding: 70px 10px 10px;
background-color: #353535;
border-radius: 3px;
/* box-shadow:0 0 20px rgba(0,0,0,0.8); */
position: relative;
}
.profile:before, .profile:after
{
z-index: -1;
position: absolute;
content: "";
bottom: 15px;
left: 10px;
width: 50%;
top: 80%;
max-width:300px;
background: #777;
-webkit-box-shadow: 0 15px 10px rgb(105, 105, 105);
-moz-box-shadow: 0 15px 10px #777;
box-shadow: 0 15px 10px #777;
-webkit-transform: rotate(-3deg);
-moz-transform: rotate(-3deg);
-o-transform: rotate(-3deg);
-ms-transform: rotate(-3deg);
transform: rotate(-3deg);
}
.profile:after
{
-webkit-transform: rotate(3deg);
-moz-transform: rotate(3deg);
-o-transform: rotate(3deg);
-ms-transform: rotate(3deg);
transform: rotate(3deg);
right: 10px;
left: auto;
}
.profile img {
top: -60px;
position: absolute;
left: calc(50% - 60px);
border: 10px solid #e3e3e3;
}
.user {
width: 120px;
height: 120px;
border-radius: 50%;
}
.profile h3 {
font-size: 23px;
margin-top: 15px;
color: #790505;
}
.credentials {
font-weight: bolder;
}
.credentials span {
font-size: 12px;
color: #777;
}
.profile blockquote {
font-size: 16px;
line-height: 30px;
/* quotes: "\201C""\201D""\2018""\2019"; FOR USE WITH QUOTES TO SOLVE NESTED ISSUE WITH CODE BELOW */
}
.profile blockquote::before {
content: open-quote;
font-size: 50px;
position: relative;
color: #790505;
line-height: 20px;
bottom: -15px;
right: 5px;
}
.profile blockquote::after {
content: close-quote;
font-size: 50px;
position: relative;
color: #790505;
line-height: 10px;
bottom: -15px;
right: 5px;
}
.profile blockquote {
height: 161px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<body>
<!-- HOME -->
<section id="home" class="section1">
<div class='container'>
<div class="row justify-content-center">
<div class="col-md-12 col-sm-12">
<p class='intro'>
Hello, my name is <span class="highlight animated fadeIn" style="animation-delay: 1s; animation-duration: 1.8s">King.</span>
<br>
<div class="intro animated fadeInLeft" style="animation-delay: 3s; animation-duration: 2s">And I'm a full-stack web developer.</div>
<a href="#myanchor"><button type="button" class="home-btn btn btn-primary-outline btn-xs animated fadeIn"
style="animation-delay: 5s; animation-duration: 2s">VIEW MY WORK</button></a>
</p>
</div>
</div>
</div>
</section>
<!-- NAVIGATION -->
<div id="navbar">
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<div class="container">
<div class="logo-wrapper nav-item">
<div class="logo" id="logo">
<a class="navbar-brand" href="#home"><img src="favicon.ico" alt="King's Brand Logo"></a>
</div>
<span class="brand" id="brand" style="animation-delay: 0s; animation-duration: 3s">KING MAJOR</span>
</div>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item focus">
<a class="nav-link" href="#myanchor">ABOUT
<span class="sr-only">(current)</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#myanchor2">SKILLS
<span class="sr-only">(current)</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#myanchor3">PROJECTS
<span class="sr-only">(current)</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#myanchor4">TESTIMONIALS
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#contact">CONTACT
<span class="sr-only">(current)</span>
</a>
</li>
</ul>
</div>
</div>
</nav>
</div>
<!-- ABOUT -->
<div class="blank" style="position: absolute">
<a id="myanchor"></a>
</div>
<section id="about" class="section2">
<div class="row-fluid">
<div class="row">
<div class="card ">
<div class="card-block">
<div class="card-title">
<h1>Welcome, let's talk!</h1>
</div>
<div id="container">
<p> I started independent web development two years ago, and haven't looked back. A couple of things I love about coding are those moments when tough projects are complete, or discovering a solution to a difficult problem. Take a look at my
skills, and some of my recent projects. THANKS!
</p>
Print My Resume
</div>
</div>
</div>
</div>
</div>
</section>
<!-- SKILLS -->
<div class="blank" style="margin: -65px 0px 250px 0px; position: absolute;">
<a id="myanchor2"></a>
</div>
<section id="skills" class="section3">
<div class="row justify-content-center">
<div class="col-md-7 col-sm-12">
<div class="card text-center">
<div class="container">
<div class="card-title">
<h2>Tech I've learned:</h2>
</div>
<div class="col"><img class="code-icon" src="assets/images/code-solid.png" style="height: 12%; width: 12%; ">
<p>JavaScript, HTML, CSS, MongoDB, Express, Node.js, Bootstrap, mySQL, AWS Cloud Storage, and more...</p>
<h2>Tools I use:</h2>
<ul>
<li>Visual Studio Code</li>
<li>Github</li>
<li>Express</li>
<li>Linux</li>
<li>Axios</li>
<li>npm</li>
<li>Bash</li>
<li>Chrome Developer Tools</li>
<li>And more...</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- PROJECTS -->
<div class="blank" style="margin: -65px 0px 250px 0px; position: absolute;">
<a id="myanchor3"></a>
</div>
<section id="projects" class="section4">
<div class="container">
<div class="row justify-content-center">
<h1>My Recent Projects</h1>
<p class="works-description">These are all self-directed projects. You can find more work on my
Github.<br> Below are just some of my most recent works. Let me know if you have any questions!
</p>
<div class="row justify-content-center">
<div class="col-md-5 col-sm-12">
<div class="text-center">
<div class="card-block">
<div class="card-image-container">
<a href="https://kingdomb.github.io/google-promo/">
<img src="assets/images/laptop-project-insertion-floating1SHADOW.png" alt="Google-Promo-Project">
</a>
</div>
<div class="card-body">
<div class="card-app-name card-title">
<h2>Google Home</h2>
</div>
<p class="card-tech card-text">JavaScript, HTML, CSS, Bootstrap</p>
<p class="summary">Summary</p>
<div class="card-summary card-text">
This project displays my use of javascript animations, and website design best practices. Firsts in this project included the added animations. </div>
<a href="https://kingdomb.github.io/google-promo/" class="btn btn-darker-moon btn-rounded">View
Demo</a>
View Code
</div>
</div>
</div>
</div>
<div class="col-md-5 col-sm-12">
<div class="text-center">
<div class="card-block">
<div class="card-image-container">
<a href="https://kingdomb.github.io/Food_Searcher/">
<img src="assets/images/laptop-project-insertion-floating2SHADOW.png" alt="Nutrition-Searcher-Project">
</a>
</div>
<div class="card-body">
<div class="card-app-name card-title">
<h2>Nutrition Searcher</h2>
</div>
<p class="card-tech card-text">jQuery, JS, HTML, REST APIs, Regex, Materialize</p>
<p class="summary">Summary</p>
<div class="card-summary card-text">
This app returns nutritional value of foods, and calculates the length of time it takes to burn those calories.</div>
<a href="https://kingdomb.github.io/Food_Searcher/" class="btn btn-darker-moon btn-rounded">View
Demo</a>
<a href="https://github.com/KingdomB/Food_Searcher" class="btn btn-dark-moon btn-rounded">View
Code</a>
</div>
</div>
</div>
</div>
<div class="col-md-5 col-sm-12">
<div class="card text-center">
<div class="card-block">
<div class="card-image-container">
<a href="https://raw.githubusercontent.com/KingdomB/Bamazon/master/bamazon.gif">
<img src="assets/images/laptop-project-insertion-floating3SHADOW.gif" alt="Bamazon-gif">
</a>
</div>
<div class="card-body">
<div class="card-app-name card-title">
<h2>Bamazon CLI Store</h2>
</div>
<p class="card-tech card-text">JavaScript, Node.js, MySQL</p>
<p class="summary">Summary</p>
<div class="card-summary card-text">
Created an small Amazon-like storefront. The store interface prompts the user to select an item for purchase. After a quantity selection the inventory adjusts accordingly.</div>
View Demo
View Code
</div>
</div>
</div>
</div>
<div class="col-md-5 col-sm-12">
<div class="card text-center">
<div class="card-block">
<div class="card-image-container">
<a href="https://raw.githubusercontent.com/KingdomB/liri-node-app/master/liri-node-app.gif">
<img src="assets/images/laptop-project-insertion-floating4SHADOW.gif" alt="LIRI-Node-Project">
</a>
</div>
<div class="card-body">
<div class="card-app-name card-title">
<h2>LIRI-Node-CLI</h2>
</div>
<p class="card-tech card-text"> JavaScript, Node.js, Axios, RESTful APIs, Inquirer</p>
<p class="summary">Summary</p>
<div class="card-summary card-text">
Command line user interface that receives search query inputs, and GET requests to return results from music, movie, and concert APIs</div>
View Demo
<a href="https://github.com/KingdomB/liri-node-app" class="btn btn-dark-moon btn-rounded">View
Code</a>
</div>
</div>
</div>
</div>
</section>
</body>
</html>
So I have created a page and tried my best to use Bootstrap 4. But here is the thing, the page has all types of responsive errors, and one of the hallmarks of Bootstrap is that it is responsive. So, I would like some advice on the errors that I note below, please.
At 1199px X 836 both cards on the left in the "projects" section decrease vertically by maybe 20px.
-I would like all four cards to stay the same size and of course at some point the cards should display: block. But not at 1199px.
At 1124 the "about" section creates a top and bottom grey border, but what is more interesting is that 1027px X 836 the text wraps and things get ugly.
At 991px X 836px everything becomes messy. Navbar logo and logo-brand wrap and extend outside of the navbar container, about section text starts to push out of its container, and testimonials text starts overlapping.
I don't fully understand the css position methods and I believe this may be the issue, but if you can help me to get a better understanding of what I am doing wrong then I would greatly appreciate it.
Thanks
PS. I don't want to load down the post with my code so here is a link to the repo and the page:
repo
page
You must add bootstrap cdn link. Add this in head tag:
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
and this in at the end of body:
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous">
</script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous">
</script>
Or go to this page and download the bootstrap file if you want to use bootstrap also offline
Related
CSS scale and transform shows lines in my Chrome browser
I want to create for my <a> section nice looking smooth zoom-in effect when user points his mouse on it. It works,but for some reason I have lines between my <div> sections inside the <a> section. Here is my example: http://jsfiddle.net/p1g0Lzu3/23/ So, on hover, there are two gray lines, which I don't want to be there. I tried various things, but still I can't find the way to fix that.
The easiest fix is to give the wrapper the same background color as the divs inside .wrapper { background-color: #243964; }
There is something with not setting a height to .main class that puts those lines in there. With static position by default, it will try to fill any unfilled space. It's kind of a weird concept but I was able to fix it by adding: /* additions */ .main { height: 80%; } Also, I assume you have the scroll there for a reason so I didn't change that around at all. I added the media queries simply for snippet viewing sake. I suggest clicking full-page .container-box { transform: translateX(70%); display: flex; width: 40%; flex-direction: row; justify-content: space-between; padding-top: 40px; padding-bottom: 40px; } .shadow-bottom { -webkit-box-shadow: 0 12px 0px 6px #6076a7; -moz-box-shadow: 0 12px 0px -6px #6076a7; box-shadow: 0 12px 0px -6px #6076a7; } .wrapper { backface-visibility: hidden; -webkit-transform: translateZ(0); display: flex; flex-flow: row wrap; flex: 100px; margin: 20px; text-align: center; } .wrapper:hover { -webkit-transform: scale(1.2); -moz-transform: scale(1.2); -ms-transform: scale(1.2); -o-transform: scale(1.2); transform: scale(1.2); } .wrapper > * { flex: 1 100%; } .header { background: #243964; text-align: left; color: #dbd6d6; padding: 20px; font-size: 12px; } .hr1 { border: 0; border-top: 1px solid #4990e2; } .footer { background: #243964; text-align: left; color: white; padding: 20px; font-size: 14px; } .main { text-align: left; background: #243964; color: #fefefe; padding: 20px; padding-top: 35px; padding-bottom: 20px; height: 200px; } .box-title { font-weight: 600; font-size: 20px; padding-bottom: 10px; color: white; } .box-content { line-height: 1.9; font-size: 12px; color: #dbd6d6; } .box-paragraph { word-spacing: 4px; } .main .footer { height: fit-content; overflow: hidden; } /* additions */ .main { height: 80%; } #media only screen and (max-width: 1400px) { .container-box { width: 100%; height: 100%; } .header { height: 40px; } } <div class="container-box"> <a href="#" class="wrapper shadow-bottom"> <header class="header">Header 0</header> <article class="main"> <div class="box-title">Title 0</div> <p class="box-content">Some long text here hehehe jsdshsjhdshdsjhd</p> </article> <footer class="footer"> <hr class="hr1"> <div class="learn-more"> Learn more </div> </footer> </a> <a href="#" class="wrapper shadow-bottom"> <header class="header">Header 1</header> <article class="main"> <div class="box-title">Title 1</div> <p class="box-content">sdsdsdsd</p> </article> <footer class="footer"> <hr class="hr1"> <div class="learn-more"> Learn more </div> </footer> </a> </div> OR check out my fiddle
so, I got another approach for your question, in which you have to change your "height:200px" to "min-height:200px" in 'main' class. .container-box { transform: translateX(70%); display: flex; width: 40%; flex-direction: row; justify-content: space-between; padding-top: 40px; padding-bottom: 40px; } .shadow-bottom { -webkit-box-shadow: 0 12px 0px 6px #6076a7; -moz-box-shadow: 0 12px 0px -6px #6076a7; box-shadow: 0 12px 0px -6px #6076a7; } .wrapper { backface-visibility: hidden; -webkit-transform: translateZ(0); display: flex; flex-flow: row wrap; flex: 100px; margin: 20px; text-align: center; } .wrapper:hover { -webkit-transform: scale(1.2); -moz-transform: scale(1.2); -ms-transform: scale(1.2); -o-transform: scale(1.2); transform: scale(1.2); } .wrapper > * { flex: 1 100%; } .header { background: #243964; text-align: left; color: #dbd6d6; padding: 20px; font-size: 12px; } .hr1 { border: 0; border-top: 1px solid #4990e2; } .footer { background: #243964; text-align: left; color: white; padding: 20px; font-size: 14px; } .main { text-align: left; background: #243964; color: #fefefe; padding: 20px; padding-top: 35px; padding-bottom: 20px; min-height: 200px; } .box-title { font-weight: 600; font-size: 20px; padding-bottom: 10px; color: white; } .box-content { line-height: 1.9; font-size: 12px; color: #dbd6d6; } .box-paragraph { word-spacing: 4px; } <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <link rel="stylesheet" href="custom.css"> </head> <body> <div class="container-box"> <a href="#" class="wrapper shadow-bottom"> <header class="header">Header 0</header> <article class="main"> <div class="box-title">Title 0</div> <p class="box-content"> Some long text here hehehe jsdshsjhdshdsjhd </p> </article> <footer class="footer"> <hr class="hr1"> <div class="learn-more"> Learn more </div> </footer> </a> <a href="#" class="wrapper shadow-bottom"> <header class="header">Header 1</header> <article class="main"> <div class="box-title">Title 1</div> <p class="box-content"> sdsdsdsd </p> </article> <footer class="footer"> <hr class="hr1"> <div class="learn-more"> Learn more </div> </footer> </a> </div> </body> </html>
Why can't i align the div that contains text next to the div that contains the image
i'm currently working on a webpage for my design class and i have a problem. This is the browser view: I am kinda new with html and css but i have tried display in-line block, flex... Nothing worked, and i dont know what else i could do So the problem is that the text "aaaaa" must be next to image. Here is my html code: .caixa { word-wrap: break-word; width: 70%; box-shadow: 2px 2px 30px rgba(0, 0, 0, 0.2); margin: 25px; margin-left: 0px; border-radius: 10px; } .caixa-img { display: inline-block; margin: 15px; width: 15%; position: relative; } .caixa-img img { margin-right: 120px; border-radius: 10px; width: 100%; height: 100%; } .info { width: 100%; padding: 10px 20px; } .tipo {} .descripcio { display: block; background-color: chartreuse; } .tipo a { color: #222222; margin: 5px 0px; font-weight: 700; letter-spacing: 0.5px; padding-right: 8px; } .tipo span { color: rgba(26, 26, 26, 0.5); } .preu { color: #333333; font-weight: 600; font-size: 1.1rem; font-family: poppins; letter-spacing: 0.5px; } .overlay { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 100%; height: 100%; background-color: rgba(226, 197, 88, 0.6); display: flex; justify-content: center; align-items: center; } .comprar { width: 160px; height: 40px; display: flex; justify-content: center; align-items: center; background-color: #FFFFFF; color: #252525; font-weight: 700; letter-spacing: 1px; font-family: calibri; border-radius: 20px; box-shadow: 2px 2px 30px rgba(0, 0, 0, 0.2); } .comprar:hover { color: #FFFFFF; background-color: rgb(248, 171, 55); transition: all ease 0.3s; } .overlay { visibility: hidden; } .caixa-img:hover .overlay { visibility: visible; animation: fade 0.5s; } #keyframes fade { 0% { opacity: 0; } 100% { opacity: 1; } } <div class="col-12 productes"> <div class="producte1"> <div class="caixa"> <div class="caixa-img"> <img alt="" src="imgExplora/imgCarrousel/herbicida.jpg"> <div class="overlay"> Comprar </div> <div class="tipo"> <a href="#"> <h3>HERBICIDA</h3> </a> <!-- <div class="rating"> <span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span> </div>--> </div> 55€ </div> <div class="info"> <span class="descripcio">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</span> </div> </div> </div> </div>
Below an example using flexbox (see .caixa). .caixa { width: 70%; box-shadow: 2px 2px 30px rgba(0, 0, 0, 0.2); margin: 25px 25px 25px 0; /* margin-left: 0px; */ border-radius: 10px; display: flex; /* Added */ } .caixa-img { margin: 15px; width: 30%; } .caixa-img img { border-radius: 10px; width: 125px; /* For demo */ height: 125px; /* For demo */ } .info { width: 100%; padding: 10px 20px; } .tipo {} .descripcio { display: block; background-color: chartreuse; word-break: break-all; /* Essential to break large words */ } .tipo a { color: #222222; margin: 5px 0px; font-weight: 700; letter-spacing: 0.5px; padding-right: 8px; } .tipo span { color: rgba(26, 26, 26, 0.5); } .preu { color: #333333; font-weight: 600; font-size: 1.1rem; font-family: poppins; letter-spacing: 0.5px; } .overlay { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 100%; height: 100%; background-color: rgba(226, 197, 88, 0.6); display: flex; justify-content: center; align-items: center; } .comprar { width: 160px; height: 40px; display: flex; justify-content: center; align-items: center; background-color: #FFFFFF; color: #252525; font-weight: 700; letter-spacing: 1px; font-family: calibri; border-radius: 20px; box-shadow: 2px 2px 30px rgba(0, 0, 0, 0.2); } .comprar:hover { color: #FFFFFF; background-color: rgb(248, 171, 55); transition: all ease 0.3s; } .overlay { visibility: hidden; } .caixa-img:hover .overlay { visibility: visible; animation: fade 0.5s; } #keyframes fade { 0% { opacity: 0; } 100% { opacity: 1; } } <div class="col-12 productes"> <div class="producte1"> <div class="caixa"> <div class="caixa-img"> <img alt="" src="imgExplora/imgCarrousel/herbicida.jpg"> <div class="overlay"> Comprar </div> <div class="tipo"> <a href="#"> <h3>HERBICIDA</h3> </a> </div> 55€ </div> <div class="info"> <span class="descripcio">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</span> </div> </div> </div> </div>
if you use boostrap framework you can use the bootstrap column and row. <!-- language: lang-html --> <div class="row"> <div class="col-6 productes"> <div class="producte1"> <div class="caixa"> <div class="caixa-img"> <img alt="" src="imgExplora/imgCarrousel/herbicida.jpg"> <div class="overlay"> Comprar </div> </div> <div class="col-6"> <div class="tipo"> <a href="#"> <h3>HERBICIDA</h3> </a> <!-- <div class="rating"> <span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span> </div>--> </div> 55€ </div> <div class="info"> <span class="descripcio">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</span> </div> </div> </div> </div> </div> <!-- end snippet -->
You have too much nested divs that dont need to be there, just making it more complex. Also, your text is going outside your div borders, this is not a good thing. You can move your text next to the image by using flex. You always apply flex on a parent of the element that you want to move around (in this case, div with a picture, and div with a text). So you are going to apply flex to a div that holds both of those divs (div with image, and div with text). Here is my solution to this problem on a simple example, it should help you : https://codepen.io/Juka99/pen/YzGVQyv
Top border radius in linear gradient background
I am making testimonial feature in a carousel This is the sample pic of what I wanted to achieve And this is what I've achieved so far https://jsfiddle.net/2we347xu/ but this time I wanted to make the top part of the rectangle a bit more rounded like the bottom part of it and so I used border-radius but it didn't turn out the way I wanted. Here is my code .carousel-inner { position: relative; width: 100%; overflow: hidden; } .col-center { margin: 0 auto; float: none !important; } .carousel { margin: 0px auto; padding: 0 70px; height: 100%; background: linear-gradient(180deg, white 15%,#0E2149 15%); border-radius: 20px; } .carousel { position: relative; } .carousel .item { color: #fff; font-size: 14px; text-align: center; overflow: hidden; min-height: 290px; } .carousel .item .img-box { width: 200px; height: 200px; margin: 0 auto; padding: 5px; border: 10px solid #0E2149; border-radius: 50%; background: #fff; } .carousel .img-box img { width: 100%; height: 100%; display: block; border-radius: 50%; } .carousel .testimonial { padding: 0px 0 0px; line-height: 1.5; color: #fff; } .carousel .overview { font-style: italic; } .carousel .overview b { text-transform: uppercase; color: #7AA641; } .carousel .carousel-control { width: 40px; height: 40px; margin-top: -20px; top: 50%; background: none; } .carousel-control i { font-size: 30px; line-height: 65px; position: absolute; display: inline-block; color: rgba(0, 0, 0, 0.8); text-shadow: 0 3px 3px #e6e6e6, 0 0 0 #000; margin-left: -5px; } .carousel .carousel-indicators { bottom: -40px; } .carousel-indicators li, .carousel-indicators li.active { width: 10px; height: 10px; margin: 1px 3px; border-radius: 50%; } .carousel-indicators li { background: #999; border-color: transparent; box-shadow: inset 0 2px 1px rgba(0,0,0,0.2); } .carousel-indicators li.active { background: #555; box-shadow: inset 0 2px 1px rgba(0,0,0,0.2); } <div class="col-md-4"> <div class="row"> <div class="col-md-12"> <div id="myCarousel" class="carousel slide" data-ride="carousel"> <!-- Carousel indicators --> <!-- Wrapper for carousel items --> <div class="carousel-inner"> <div class="item carousel-item active"> <div class="img-box"><img src="images/cd logo.jpg" alt=""></div> <p class="testimonial">Some text here </p> <p class="overview"><b>Paula Wilson</b>, Media Analyst</p> </div> <div class="item carousel-item"> <div class="img-box"><img src="/examples/images/clients/2.jpg" alt=""></div> <p class="testimonial">Text here</p> <p class="overview"><b>Antonio Moreno</b>, Web Developer</p> </div> </div> <!-- Carousel controls --> <a class="carousel-control left carousel-control-prev" href="#myCarousel" data-slide="prev"> <i class="fa fa-angle-left"></i> </a> <a class="carousel-control right carousel-control-next" href="#myCarousel" data-slide="next"> <i class="fa fa-angle-right"></i> </a> </div> </div> <div id="background"></div> </div> </div> How do I achieve the look at the top part of the carousel?
Instead of that gradient you can use :before or :after pseudo elements, position it absolutely, under all other content, and do what you want.
It seems that it's working perfectly as expected. The problem here is that you are not able to view it because the background color of the top bar is white and so is your body background color. If you change it to something else, you'll see the difference. Either you change the color of the linear gradient to .carousel { ... background: linear-gradient(180deg, grey 15%,#0E2149 15%); /* You can use any other color than grey, it's just for demo purpose */ ... } Or you can use pseudo selectors for achieving what you want. Here's an example using ::before by setting it's position to absolute: .carousel { /* remove linear gradient from here! */ } .carousel::after { position: absolute; left: 0; top: 15%; content: ' '; width: 100%; height: 85%; background: #0E2149; z-index: -1; /* To keep it below the content */ border-radius: 20px; } .carousel::before { position: absolute; left: 0; top: 0; content: ' '; width: 100%; height: 20%; /* Extra 5% */ background: white; z-index: -2; /* To keep it below the content and the ::after element */ }
Are u expecting like this: .carousel-inner { position: relative; width: 100%; overflow: hidden; margin-bottom: 20px; border-radius: 15px; box-shadow: 0 4px 10px 0 rgba(0,0,0,0.2), 0 4px 20px 0 rgba(0,0,0,0.19); } hr{ margin:2px 40px; background-color:#cbcbcb; color: #cbcbcb; border-radius: 10px; } .col-center { margin: 0 auto; float: none !important; } .carousel { margin: 0px auto; padding: 0 70px; height: 100%; border-radius: 20px; } .carousel { position: relative; } .carousel .item { color: #fff; font-size: 14px; background-color: white; text-align: center; overflow: hidden; min-height: 290px; position: relative; } .carousel .item::after{ content: ""; display: block; background-color:#0E2149; position: absolute; left: 0; right: 0; top: 100px; bottom: 0; border-bottom-left-radius: 15px; border-bottom-right-radius: 15px; } .carousel .item > *{ position: relative; z-index: 1; } .carousel .item .img-box { width: 130px; height: 130px; margin: 0 auto; margin-top: 25px; border-radius: 50%; padding: 10px; background-color:#0E2149 ; } .carousel .img-box img { width: 100%; height: 100%; display: block; border-radius: 50%; } .carousel .testimonial { padding: 0px 0 0px; line-height: 1.5; color: white; font-weight: bold; font-size: 30px; } .carousel .overview { font-style: italic; } .carousel .overview b { text-transform: uppercase; color: #7AA641; } .carousel .carousel-control { width: 40px; height: 40px; margin-top: -20px; top: 50%; background: none; } .carousel-control i { font-size: 30px; line-height: 65px; position: absolute; display: inline-block; color: rgba(0, 0, 0, 0.8); text-shadow: 0 3px 3px #e6e6e6, 0 0 0 #000; margin-left: -5px; } .carousel .carousel-indicators { bottom: -40px; } .carousel-indicators li, .carousel-indicators li.active { width: 10px; height: 10px; margin: 1px 3px; border-radius: 50%; } .carousel-indicators li { background: #999; border-color: transparent; box-shadow: inset 0 2px 1px rgba(0,0,0,0.2); } .carousel-indicators li.active { background: #555; box-shadow: inset 0 2px 1px rgba(0,0,0,0.2); } <section class="second-section"> <div class="container"> <div class="row"> <div class="col-md-4"> <div class="row"> <div class="col-md-12"> <div id="myCarousel" class="carousel slide" data-ride="carousel"> <!-- Carousel indicators --> <!-- Wrapper for carousel items --> <div class="carousel-inner"> <div class="item carousel-item active"> <div class="img-box"><img src="https://dummyimage.com/300" alt=""></div> <p class="testimonial">Some text here </p> <hr> <p class="overview"><b>Paula Wilson</b>, Media Analyst</p> </div> </div> <div class="carousel-inner"> <div class="item carousel-item"> <div class="img-box"><img src="https://dummyimage.com/300" alt=""></div> <p class="testimonial">Text here</p> <p class="overview"><b>Antonio Moreno</b>, Web Developer</p> </div> </div> <div class="carousel-inner"> <div class="item carousel-item"> <div class="img-box"><img src="https://dummyimage.com/300" alt=""></div> <p class="testimonial">Text here</p> <p class="overview"><b>Antonio Moreno</b>, Web Developer</p> </div> </div> </div> <!-- Carousel controls --> <a class="carousel-control left carousel-control-prev" href="#myCarousel" data-slide="prev"> <i class="fa fa-angle-left"></i> </a> <a class="carousel-control right carousel-control-next" href="#myCarousel" data-slide="next"> <i class="fa fa-angle-right"></i> </a> </div> </div> <div id="background"></div> </div> </div> </div> </section>
bootstrap card overlaps on top of each other on mobile screen
So i have one "flipping card" and another bootstrap 4 card side by side like this: (I have edited the image to hide text) However when this is tested on target mobile screen using chrome's dev consolde, The 2nd Card overlaps the flipping card and completely covers it. like this: I have put the code inside the container, row and col-md-* like this: <div class="container"> <div class="row"> <div class="col-md-4"> </div> .... <div class="col-md-8"> </div> </div> </div> For full refrence, here is my full html and css code: html: <!-- start of third block --> <div class="thirdblock"> <div class="container"> <div class="row"> <div class="col-md-4"> <div class="card-container"> <div class="card"> <div class="front"> <div class="cover"> </div> <div class="user"> <img class="img-circle" src="images/...jpg" /> </div> <div class="content"> <div class="main"> <h3 class="name">.</h3> <p class="profession">.</p> <p class="">.. <div class="text-center"> <i class="fa fa-mail-forward"></i> Flip </div> </p> </div> </div> </div> <!-- end front panel --> <div class="back"> <div class="content"> <div class="main"> <p> </p> <p class="lead"> .</p> <p> </p> <br> <div class="stats-container"> <div class="stats"> <h4>100+</h4> <p> Followers </p> </div> <div class="stats"> <h4>10+</h4> <p> Following </p> </div> <div class="stats"> <h4>100+</h4> <p> Projects </p> </div> </div> </div> </div> </div> <!-- end back panel --> </div> <!-- end card --> </div> <!-- end card-container --> </div> <!-- end col-md-4 --> <div class="col-md-8"> <div class="card"> <div class="card-body"> <h4> </h4> <p class="lead"> </p> <img class="rounded mx-auto d-block" src="images/....png" /> <br> </div> </div> </div> </div><!-- end row --> </div> <!-- end container --> </div> <!-- end third block --> And the huge css code: .thirdblock { padding-top: 50px; padding-bottom: 50px; height: 100%; font-family: 'Arima Madurai', cursive; background-image: url("../images/image.jpg"); -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } .card { font-family: 'Arima Madurai', Verdana; background: none repeat scroll 0 0 #FFFFFF; border-radius: 4px; color: #444444; -webkit-box-shadow: 0px 0px 19px 0px rgba(0, 0, 0, 0.16); -moz-box-shadow: 0px 0px 19px 0px rgba(0, 0, 0, 0.16); box-shadow: 0px 0px 19px 0px rgba(0, 0, 0, 0.16); } /*Flipping Card Code*/ /*Flip Card Starts*/ .btn:hover, .btn:focus, .btn:active { outline: 0 !important; } /* entire container, keeps perspective */ .card-container { -webkit-perspective: 900px; -moz-perspective: 900px; -o-perspective: 900px; perspective: 900px; margin-bottom: 3px; } /* flip the pane when hovered */ .card-container:not(.manual-flip):hover .card, .card-container.hover.manual-flip .card { -webkit-transform: rotateY(180deg); -moz-transform: rotateY(180deg); -o-transform: rotateY(180deg); transform: rotateY(180deg); } .card-container.static:hover .card, .card-container.static.hover .card { -webkit-transform: none; -moz-transform: none; -o-transform: none; transform: none; } /* flip speed goes here */ .card { -webkit-transition: -webkit-transform .5s; -moz-transition: -moz-transform .5s; -o-transition: -o-transform .5s; transition: transform .5s; -webkit-transform-style: preserve-3d; -moz-transform-style: preserve-3d; -o-transform-style: preserve-3d; transform-style: preserve-3d; position: relative; } /* hide back of pane during swap */ .front, .back { -webkit-backface-visibility: hidden; -moz-backface-visibility: hidden; -o-backface-visibility: hidden; backface-visibility: hidden; position: absolute; top: 0; left: 0; background-color: #FFF; box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.14); } /* front pane, placed above back */ .front { z-index: 2; } /* back, initially hidden pane */ .back { -webkit-transform: rotateY(180deg); -moz-transform: rotateY(180deg); -o-transform: rotateY(180deg); transform: rotateY(180deg); z-index: 3; } .back .btn-simple { position: absolute; left: 0; bottom: 4px; } /* Style */ .card-container, .front, .back { width: 100%; border-radius: 4px; -webkit-box-shadow: 0px 0px 19px 0px rgba(0, 0, 0, 0.16); -moz-box-shadow: 0px 0px 19px 0px rgba(0, 0, 0, 0.16); box-shadow: 0px 0px 19px 0px rgba(0, 0, 0, 0.16); margin-bottom: 50px; } .card .cover { height: 105px; overflow: hidden; border-radius: 4px 4px 0 0; } .card .cover img { width: 100%; } .card .user { border-radius: 50%; display: block; height: 120px; margin: -55px auto 0; overflow: hidden; width: 120px; } .card .user img { width: 100%; } .card .content { background-color: rgba(0, 0, 0, 0); box-shadow: none; padding: 10px 20px 20px; } .card .content .main { min-height: 100%; } .card .back .content .main { height: 100%; } .card .name { font-family: 'Arima Madurai', cursive; font-size: 22px; line-height: 28px; margin: 10px 0 0; text-align: center; text-transform: capitalize; } .card h5 { margin: 5px 0; font-weight: 400; line-height: 20px; } .card .profession { color: #999999; text-align: center; margin-bottom: 20px; } .card .fofooter-toter { border-top: 1px solid #EEEEEE; color: #999999; margin: 30px 0 0; padding: 10px 0 0; text-align: center; } .card .footer-t .social-links { font-size: 18px; } .card .footer-t .social-links a { margin: 0 7px; } .card .footer-t .btn-simple { margin-top: -6px; } .card .header { padding: 15px 20px; height: 90px; } .card .motto { font-family: 'Arima Madurai', cursive; border-bottom: 1px solid #EEEEEE; color: #999999; font-size: 14px; font-weight: 400; padding-bottom: 10px; text-align: center; } .card .stats-container { width: 100%; margin-top: 50px; } .card .stats { display: block; float: left; width: 33.333333%; text-align: center; } .card .stats:first-child { border-right: 1px solid #EEEEEE; } .card .stats:last-child { border-left: 1px solid #EEEEEE; } .card .stats h4 { font-family: 'Arima Madurai', cursive; font-weight: 300; margin-bottom: 5px; } .card .stats p { color: #777777; } Can someone please help me as in what am i messing up?
just add fixed height for your .card class, because of position absolute on .front and .back classes, card class won't take any height. .card{ height:362px; }
Remove the CSS for class .front,.back /* position: absolute; */ /* top: 0; */
flipping card with more text on the back
I am trying to make my cards as flipping cards, I have created the following CSS which explains what my card look like, however I am not able to make them flipping whenever I hover my mouse on it. .row { padding-top: 25px; } .card { display: block; margin-bottom: 20px; line-height: 1.42857143; background-color: #E0E0E0s; border-radius: 2px; box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12); transition: box-shadow .25s; border-right: 100%; } .card:hover { box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); } .img-card { width: 100%; height: 200px; border-top-left-radius: 2px; border-top-right-radius: 2px; display: block; overflow: hidden; } .img-card img { width: 100%; height: 200px; object-fit: cover; transition: all .25s ease; } .card-content { padding: 15px; text-align: left; } .card-title { margin-top: 0px; font-weight: 700; font-size: 1.65em; } .card-title a { color: #000; text-decoration: none !important; } .card-read-more { border-top: 1px solid #D4D4D4; } .card-read-more a { text-decoration: none !important; padding: 10px; font-weight: 600; text-transform: uppercase } <div class="col-xs-12 col-sm-4"> <div class="card"> <a class="img-card" href="http://www.fostrap.com/"> <img src="https://images.pexels.com/photos/170811/pexels-photo-170811.jpeg?w=940&h=650&auto=compress&cs=tinysrgb" /> </a> <br /> <div class="card-content"> <h4 class="card-title"> <a href="http://www.fostrap.com/"> BMW X5 SERIES </a> </h4> <div class=""> New Delhi, 2005, Petrol </div> </div> <div class="card-read-more"> <a class="btn btn-link btn-block" href="http://www.fostrap.com/"> BID NOW </a> </div> </div> </div> I added hover class which was totally a wrong approach, please let me know which class might help me with it. thank you
#f1_container { position: relative; width: 450px; height: 281px; z-index: 1; } #f1_container { perspective: 1000; } #f1_card { width: 100%; height: 100%; transform-style: preserve-3d; transition: all 1.0s linear; } #f1_container:hover #f1_card { transform: rotateY(180deg); box-shadow: -5px 5px 5px #aaa; } .face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; } .face.back { transform: rotateY(180deg); box-sizing: border-box; padding: 10px; color: white; text-align: center; } <div class="col-xs-12 col-sm-4"> <div id="f1_container"> <div class="card"> <div id="f1_card" class="shadow"> <div class="front face"> <a class="img-card" href="http://www.fostrap.com/"> <img src="https://images.pexels.com/photos/170811/pexels-photo-170811.jpeg?w=940&h=650&auto=compress&cs=tinysrgb" /> </a> <br /> <a href="http://www.fostrap.com/"> BMW X5 SERIES </a> New Delhi, 2005, Petrol </h4> <a class="btn btn-link btn-block" href="http://www.fostrap.com/"> BID NOW </a> </div> <div class="back face center"> <a class="img-card" href="http://www.fostrap.com/"> <img src="https://images.pexels.com/photos/112460/pexels-photo-112460.jpeg?auto=compress&cs=tinysrgb&h=350" /> </a> </div> </div> </div> </div> </div>