I'm experiencing an issue with a div element in the header of my website, where the content of the div is overlapping with other elements in the header. This issue can have various causes, including incorrect positioning, improper use of CSS styles, and conflicting styles among elements. But I can't see what is happening, does anybody see what is happening?
I'm using a Laravel project with Vue and TailwindCSS. But I'm not making any difficult part know, I just want to put some information in cards.
This is what I tried:
HTML
#extends('layouts.user')
#section('content')
<h1 style="text-align: center"><strong>CURSOS</strong></h1>
<div class="flip-card-container">
<div class="flip-card">
<div class="flip-card-inner">
<div class="flip-card-front">
<p class="title">FLIP CARD</p>
<p>Hover Me</p>
</div>
<div class="flip-card-back">
<p class="title">BACK</p>
<p>Leave Me</p>
</div>
</div>
</div>
<div class="flip-card">
<div class="flip-card-inner">
<div class="flip-card-front">
<p class="title">FLIP CARD</p>
<p>Hover Me</p>
</div>
<div class="flip-card-back">
<p class="title">BACK</p>
<p>Leave Me</p>
</div>
</div>
</div>
<div class="flip-card">
<div class="flip-card-inner">
<div class="flip-card-front">
<p class="title">FLIP CARD</p>
<p>Hover Me</p>
</div>
<div class="flip-card-back">
<p class="title">BACK</p>
<p>Leave Me</p>
</div>
</div>
</div>
<div class="flip-card">
<div class="flip-card-inner">
<div class="flip-card-front">
<p class="title">FLIP CARD</p>
<p>Hover Me</p>
</div>
<div class="flip-card-back">
<p class="title">BACK</p>
<p>Leave Me</p>
</div>
</div>
</div>
</div>
#stop
CSS
#tailwind base;
#tailwind components;
#tailwind utilities;
/* Beggining of card aesthetic */
.flip-card {
background-color: transparent;
width: 300px;
height: 300px;
float: left;
margin: 20px;
perspective: 1000px;
font-family: sans-serif;
position: relative;
z-index: 0;
}
.flip-card-container {
min-height: calc(100vh - 70px);
overflow: hidden;
position: relative;
z-index: 0;
}
.title {
font-size: 1.5em;
font-weight: 900;
text-align: center;
margin: 0;
}
.flip-card-inner {
position: relative;
width: 100%;
height: 100%;
text-align: center;
transition: transform 0.8s;
transform-style: preserve-3d;
}
.flip-card:hover .flip-card-inner {
transform: rotateY(180deg);
}
.flip-card-front, .flip-card-back {
box-shadow: 0 8px 14px 0 rgba(0,0,0,0.2);
position: absolute;
display: flex;
flex-direction: column;
justify-content: center;
width: 100%;
height: 100%;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
border: 1px solid coral;
border-radius: 1rem;
}
.flip-card-front {
background: url(/de/tu/imagen.jpg);
background-size: cover;
color: coral;
}
.flip-card-back {
background: linear-gradient(120deg, rgb(255, 174, 145) 30%, coral 88%,
bisque 40%, rgb(255, 185, 160) 78%);
color: white;
transform: rotateY(180deg);
}
/*Final */
body {
#apply font-montserrat;
}
.login-background {
background-image: url(/resources/img/fondo.svg);
background-repeat: no-repeat;
background-color: #dcdcdc;
position: relative;
z-index: 0;
}
header {
height: 70px;
#apply bg-orange-500;
position: relative;
z-index: 2;
}
footer {
#apply text-white;
}
footer a {
#apply hover:text-orange-500;
}
footer h6 {
#apply font-bold;
}
footer svg {
#apply inline-block w-8 h-8;
}
Result of the problem:
Content overlapping in the header
Related
I created a cards-based horizontal scroller. And the cards are nicely scrolling inside the wrapper. The issue I'm having is that even after I applied the z-index to our member-owner-card-image, the photos still go under the card when I want to put them on the top of each card.
Is there any solution so that I can add the image on top of the card? I'm trying to fix it, but no solution has been found.
.scrolling-wrapper {
-webkit-overflow-scrolling: touch;
height: 331px;
width: 100%;
padding-inline: 40px;
position: relative;
display: flex;
flex-wrap: nowrap;
overflow-x: auto;
z-index: 0;
}
.scrolling-wrapper::-webkit-scrollbar {
display: none;
}
.card {
width: 100%;
flex: 0 0 auto;
background-color: green;
border-radius: 20px;
position: relative;
margin-right: 10px;
}
.our-member-owner-card-image {
position: absolute;
top: -30px;
z-index: 10;
}
.card-content {
position: absolute;
padding-top: 38px;
}
.member-detail {
padding-top: 55px;
line-height: 1.7;
}
.member-detail h3 {
text-align: center;
color: #263244;
font-weight: 700;
font-family: 'Lato';
}
.member-detail p {
text-align: center;
color: #737C89;
}
.member-description {
padding-inline: 20px;
color: #263244;
line-height: 1.6;
padding-top: 9px;
font-weight: 500;
font-size: 17px;
}
.member-description span {
color: red;
text-decoration: underline;
}
<div class="scrolling-wrapper">
<div class="card">
<div class="our-member-owner-card-image">
<img width="220px" src="https://images.unsplash.com/photo-1661961110144-12ac85918e40?ixlib=rb-4.0.3&ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=870&q=80" />
</div>
<div class="card-content">
<div class="member-detail">
<h3>Sohaib</h3>
<p>Chairman</p>
</div>
<div class="member-description">
Sohaib Ashraf has extensive work experience during his career
of more than 25 years in the financial services sector.<span
>Read more</span
>
</div>
</div>
</div>
<div class="card">
<div class="our-member-owner-card-image">
<img width="220px" src="https://images.unsplash.com/photo-1661961110144-12ac85918e40?ixlib=rb-4.0.3&ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=870&q=80" />
</div>
<div class="card-content">
<div class="member-detail">
<h3>Sohaib Ashraf</h3>
<p>Chairman</p>
</div>
<div class="member-description">
Sohaib Ashraf has extensive work experience during his career
of more than 25 years in the financial services sector.<span
>Read more</span
>
</div>
</div>
</div>
</div>
You could add the image as a background-image to the card. I added few examples how you can use background-image:
.card{
width: 400px;
height: 300px;
margin: 10px;
border-radius: 6px;
background-color: gray;
}
.card-1, .card-2 .image, .card-3 .image{
/* Here, we use background-image to set the image */
background-image: url("https://images.unsplash.com/photo-1661961110144-12ac85918e40?ixlib=rb-4.0.3&ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=870&q=80");
/* The background should be a cover photo,
so it fills the whole card: */
background-size: cover;
/* We don't want the image to repeat itself */
background-repeat: no-repeat;
/* When the ratio of the image changes, it will zoom into
this point, which we want to happen in the center of the image */
background-position: center;
}
.card-2, .card-3{
display: grid;
grid-template-rows: 1fr 1fr;
}
.card-2 .image{
border-radius: 6px 6px 0px 0px;
}
.card-3{
padding: 10px;
}
/* This is to demonstrate: */
h2{
color: white;
display: flex;
justify-content: center;
font-family: sans-serif;
}
<div class="card-1 card">
<h2>Test title</h2>
</div>
<div class="card-2 card">
<div class="image"></div>
<div class="content">
<h2> Test title</h2>
</div>
</div>
<div class="card-3 card">
<div class="image"></div>
<div class="content">
<h2> Test title</h2>
</div>
</div>
header {
background: blue;
color: white;
width: 100%;
}
.container {
background: green;
text-align: center;
width: 100%;
height: 100px;
transform: skew(0, -10deg);
color: white;
position: relative;
top: 55px;
}
.container .home{
position:absolute;
bottom:0;
}
<header class="header">
<div class="logo">
<i class="fab fa-accusoft"></i>
<span class="title">DreamCoding</span>
</div>
<section class="container">
<div class="home">
<div class="title">Alphabet</div>
<div class="text">
abcdefg
</div>
</div>
</section>
I have the box and the box.
I'm trying to cover the container box by the header box.
The problem is that the box was covered by the , box again and again.
I'm not sure I explained properly cause English is not my mother tongue.
Anyway, Thanks in advance.
Just add the z-index property to both the elements. Runnable code snippet below:
header {
background: blue;
color: white;
width: 100%;
z-index: 1;
}
.container {
background: green;
text-align: center;
width: 100%;
height: 100px;
transform: skew(0, -10deg);
color: white;
position: relative;
top: 55px;
z-index: -1;
}
.container .home {
position: absolute;
bottom: 0;
}
<html>
<body>
<header class="header">
<div class="logo">
<i class="fab fa-accusoft"></i>
<span class="title">DreamCoding</span>
</div>
<section class="container">
<div class="home">
<div class="title">Alphabet</div>
<div class="text">
abcdefg
</div>
</div>
</section>
</header>
</body>
</html>
**The z-index property is used to make elements overlap others.
You can set background in :before selector using position:absolute and z-index:-1
body{
margin: 0;
}
header {
background: blue;
color: white;
width: 100%;
}
.container {
text-align: center;
width: 100%;
height: 100px;
color: white;
position: relative;
top: 55px;
}
.container:before {
content:"";
transform: skew(0, -10deg);
background: green;
width: 100%;
height: 100%;
position:absolute;
top:-25px;
left: 0;
z-index: -1;
}
.container .home{
position:absolute;
bottom:0;
}
<header class="header">
<div class="logo">
<i class="fab fa-accusoft"></i>
<span class="title">DreamCoding</span>
</div>
<section class="container">
<div class="home">
<div class="title">Alphabet</div>
<div class="text">
abcdefg
</div>
</div>
</section>
</header>
I wish to place three flip-boxes in a circular form. Below is the code I got:
body {
font-family: Arial, Helvetica, sans-serif;
}
.flip-box {
background-color: transparent;
width: 300px;
height: 200px;
border: 1px solid #f1f1f1;
perspective: 1000px;
}
.flip-box-inner {
position: relative;
width: 100%;
height: 100%;
text-align: center;
transition: transform 0.8s;
transform-style: preserve-3d;
}
.flip-box:hover .flip-box-inner {
transform: rotateX(180deg);
}
.flip-box-front, .flip-box-back {
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
}
.flip-box-front {
background-color: #bbb;
color: black;
}
.flip-box-back {
background-color: dodgerblue;
color: white;
transform: rotateX(180deg);
}
/* position of parent-flipbox */
.first-flipbox{
width:471px;
height:471px;
position: relative;
}
/* child flipbox positions */
.first-flipbox{ left: 184px; top: -38px; }
.second-flipbox{ left: 376px; top: 295px; }
.third-flipbox{ left: -8px; top: 295px; }
<div class="first-flipbox">
<div class="flip-box">
<div class="flip-box-inner">
<div class="flip-box-front">
<h2>Front Side</h2>
</div>
<div class="flip-box-back">
<h2>Back Side</h2>
</div>
</div>
</div>
</div>
<div class="second-flipbox">
<div class="flip-box">
<div class="flip-box-inner">
<div class="flip-box-front">
<h2>Front Side</h2>
</div>
<div class="flip-box-back">
<h2>Back Side</h2>
</div>
</div>
</div>
</div>
<div class="third-flipbox">
<div class="flip-box">
<div class="flip-box-inner">
<div class="flip-box-front">
<h2>Front Side</h2>
</div>
<div class="flip-box-back">
<h2>Back Side</h2>
</div>
</div>
</div>
</div>
The issue is that I can't succeed in placing the second and third flip-boxes at their respective place (i.e facing eachother and on the same horizontal line, below the first one) as I succeeded in placing the first flip-box at its position. I've looked through several times and I can't still figure out the typo.
Thanks for some help.
In this case you need to use absolute positions not relative however I added a wrapper div around all items which has relative position. Also Add position:absolute and display:inline-block to all three boxes as the divs are blocks by default;
body {
font-family: Arial, Helvetica, sans-serif;
}
.flip-box {
background-color: transparent;
width: 300px;
height: 200px;
border: 1px solid #f1f1f1;
perspective: 1000px;
}
.flip-box-inner {
position: relative;
width: 100%;
height: 100%;
text-align: center;
transition: transform 0.8s;
transform-style: preserve-3d;
}
.flip-box:hover .flip-box-inner {
transform: rotateX(180deg);
}
.flip-box-front, .flip-box-back {
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
}
.flip-box-front {
background-color: #bbb;
color: black;
}
.flip-box-back {
background-color: dodgerblue;
color: white;
transform: rotateX(180deg);
}
/* position of parent-flipbox */
.first-flipbox{
width:471px;
height:471px;
position: relative;
}
/* child flipbox positions */
.first-flipbox{ position:absolute;display:inline-block;left: 184px; top: -38px; }
.second-flipbox{ position:absolute;display:inline-block;left: 376px; top: 295px; }
.third-flipbox{ position:absolute;display:inline-block; left: -8px; top: 295px; }
<div style="position:relative">
<div class="first-flipbox">
<div class="flip-box">
<div class="flip-box-inner">
<div class="flip-box-front">
<h2>Front Side</h2>
</div>
<div class="flip-box-back">
<h2>Back Side</h2>
</div>
</div>
</div>
</div>
<div class="second-flipbox">
<div class="flip-box">
<div class="flip-box-inner">
<div class="flip-box-front">
<h2>Front Side</h2>
</div>
<div class="flip-box-back">
<h2>Back Side</h2>
</div>
</div>
</div>
</div>
<div class="third-flipbox">
<div class="flip-box">
<div class="flip-box-inner">
<div class="flip-box-front">
<h2>Front Side</h2>
</div>
<div class="flip-box-back">
<h2>Back Side</h2>
</div>
</div>
</div>
</div>
</div>
How i can place my div with button, form and other content on an image like this picture. I have already placed the text on this image using this code:
.img-wrap {
position: relative;
}
.img-wrap h1 {
position: absolute;
left: 41.5%;
bottom: 45%;
background: rgba(255, 255, 255, 0.9);
height: 20%;
width: 17%;
padding: 3% 0px 0px 2.4%;
font-size: 2.3vw;
font-weight: bold;
color: rgba(0, 0, 0, 1);
font-family: Alegreya Sans black;
}
<div class="container-fluid">
<div class="row">
<div class="img-wrap">
<img src="...\images\main-foto.jpeg" class="img-responsive">
<h1>Funny Island</h1>
</div>
</div>
</div>
I tried to place my div on the same way, but it doesn't work.
.img-wrap {
position: relative;
}
.img-wrap div {
position: absolute;
width: 1000px;
height: 900px;
background-color: grey;
}
<div class="container-fluid">
<div class="row">
<div class="img-wrap">
<img src="...\images\main-foto.jpeg" class="img-responsive">
<h1>Funny Island</h1>
<div>
</div>
</div>
</div>
</div>
Thanks for the help
Add the image as a background image on .img-wrap. You can then add the buttons, text etc inside the div.
.img-wrap {
position: relative;
background-image: url( 'http://placekitten.com/500/300' );
background-size: cover;
text-align: center;
padding: 50px;
color: red;
}
<div class="container-fluid">
<div class="row">
<div class="img-wrap">
<h1>Funny Island</h1>
<div>
<p>Some text here</p>
<button>Button here</button>
</div>
</div>
</div>
</div>
You can use a negative on themargin-bottom of the element that you wish to contain the image. This will pull the element containing your form content up and above the element with the image inside it. See below for a demo:
.image-container {
height: 50vh;
background: red;
margin-bottom: -200px;
}
.content-container {
height: 150vh;
max-width: 960px;
margin: auto;
background: blue;
}
<div class="image-container"></div>
<div class="content-container"></div>
Another option is to add top or left properties to img-wrap div to position it where you want.
.img-wrap div{
position: absolute;
width:1000px;
height: 900px;
background-color: grey;
top:100px;
left:100px;
}
I've built a card flip effect that seems to work on Safari Mobile regarding the "flip" aspect of the effect. However, the card is not displaying the correct image upon flipping. I'm using the effect as a "Before and After", using separate images on each side of the card. I'll post my code. Thank you.
.beforeafter {
margin: 10px auto;
text-align: center;
}
.card-container {
cursor: pointer;
height: 300px;
perspective: 600;
position: relative;
width: 300px;
display: inline-block;
}
.clientcard {
height: 100%;
position: absolute;
transform-style: preserve-3d;
transition: all .5s ease-in-out;
width: 100%;
}
.clientcard:hover {
transform: rotateY(180deg);
-webkit-transform: -webkit-translateY(180deg);
}
.clientcard .side {
backface-visibility: hidden;
border-radius: 2px;
height: 100%;
position: absolute;
overflow: hidden;
width: 100%;
}
.clientcard .back {
background: #eaeaed;
color: #0087cc;
line-height: 150px;
text-align: center;
transform: rotateY(180deg);
}
<div class="beforeafter">
<div class="card-container">
<div class="clientcard">
<div class="side"><img src="img/sean1.JPG"></div>
<div class="side back"><img src="img/sean1copy.JPG"></div>
</div>
</div>
<div class="card-container">
<div class="clientcard">
<div class="side"><img src="img/sean2.JPG"></div>
<div class="side back"><img src="img/sean2copy.JPG"></div>
</div>
</div>
<div class="card-container">
<div class="clientcard">
<div class="side"><img src="img/sean3copy.jpg"></div>
<div class="side back"><img src="img/sean3.jpg"></div>
</div>
</div>
<div class="card-container">
<div class="clientcard">
<div class="side"><img src="img/gwork.jpg"></div>
<div class="side back"><img src="img/alana2.jpeg"></div>
</div>
</div>
</div>
I believe you want to rotate on the Y axis in the negitive -180deg. I improved your code a bit and don't mind the shitty format it was translated from sass and if you want another card with flip copy and past that code
.card {
perspective: 150rem;
-moz-perspective: 150rem;
position: relative;
height: 52rem; }
.card_side {
height: 52rem;
transition: all 2s ease;
position: absolute;
top: 0;
left: 0;
width: 100%;
backface-visibility: hidden;
}
.card_side-front {
background-color: blue;
}
.card_side-back {
transform: rotateY(180deg);
}
.card_side-back-1 {
background-image: linear-gradient(to right bottom, #ffb900, #ff7730);
}
.card:hover .card_side-front {
transform: rotateY(-180deg);
}
.card:hover .card_side-back {
transform: rotateY(0);
}
.card_picture-1 {
background-color: blue;
}
<div class="row">
<div class="col-1-of-3">
<div class="card">
<div class="card_side card_side-front">
<h4 class="card_heading">
<span class="card_heading-span card_heading-span-1">card front text</span>
</h4>
</div>
<div class="card_side card_side-back card_side card_side-back-1">
<div class="card_cta">
<div class="card_price-box">
<p class="card_price-only">back text</p>
</div>
</div>
</div>
</div>
</div>