Can't padding flex layout do not broken width columns? - html

I have two the problem:
First: I can't padding or margin .card element. I want to add space between each card without broken columns.
It set width: 33.333%, change padding or margin of card element, it will be broken to 2 elements in one rows.
Second, I want to add a link to .card. Mean: if the user clicks in one of the 3 cards, it will open.
Currently, I must add <a href=""> to each span, img,... Lost time and broken CSS.
Here my example code:
.card-container {
display: flex;
flex-wrap: wrap;
flex-direction: row;
border-radius: 4px;
overflow: hidden;
padding: 5px;
}
.card {
display: flex;
flex-direction: column;
border-radius: 4px;
align-items: left;
padding: 0 0 15px 0;
width: 33.333%;
background: #ecf0f1;
box-shadow: 0px 3px 10px 1px rgba(0, 0, 0, 0.1);
}
.card__image {
position: relative;
width: 100%;
display: block;
height: 125px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
overflow: hidden;
}
.card__image:hover {
cursor: pointer;
}
.card__image:hover:after {
bottom: 0;
color: white;
transition: all 0.15s;
}
.card__image:hover .image-overlay {
background-color: rgba(35, 155, 55, 0.33);
transition: all 0.15s;
}
.card__image:after {
display: flex;
justify-content: center;
align-items: center;
bottom: -4em;
position: absolute;
width: 100%;
height: 100%;
font-family: "FontAwesome";
font-size: 1em;
text-align: center;
content: "\f00c";
color: rgba(255, 255, 255, 0);
color: #fff;
transition: all 0.15s;
}
.card__image .image-overlay {
display: block;
position: absolute;
width: 100%;
height: 125px;
top: 0;
left: 0;
content: "";
background-color: rgba 255, 255, 255, 0;
transition: backgroundColor, 0.15s;
}
.card__image img {
display: block;
width: 100%;
}
.card__actions {
font-family: serif;
font-size: 25px;
line-height: 12px;
color: #a3a3a3;
text-align: right;
padding: 0 8px 0 0;
margin: 0;
}
span {
display: block;
border-radius: 3px;
margin: 0.5em 0.5em 0 0.5em;
color: #88888b;
}
span.line {
background: #f0f0f0;
color: #000;
margin: 0;
padding: 0.5em 0.5em;
text-align: center;
}
span._short1 {
color: #fff;
background: linear-gradient(to right, #1f4037, #99f2c8);
}
span._short2 {
color: #fff;
background: linear-gradient(to right, #fc4a1a, #f7b733);
}
span._short3 {
color: #fff;
background: linear-gradient(to right, #ec008c, #fc6767);
}
<div class="card-container card--fixedWidth">
<div class="card">
<div class="card__image" id="card-1">
<div class="image-overlay">
</div>
<img src="http://www.fubiz.net/wp-content/uploads/2014/11/Lotta-Nieminen_Google_07-640x553.jpg" alt="" />
</div>
<div class="card__actions">
<!-- … -->
</div>
<div class="card__description">
<span class="line _short1">Tải bộ cài Windows, Office chính chủ</span>
<span class="line _long">Link trực tiếp từ server Microsoft giúp bạn dễ dàng chọn bất cứ phiên bản nào!</span>
</div>
</div><!-- /.card -->
<div class="card">
<div class="card__image" id="card-2">
<div class="image-overlay">
</div>
<img src="https://s-media-cache-ak0.pinimg.com/736x/e7/f2/98/e7f298f2db462652fd8b9a1ee888458a.jpg" alt="" />
</div>
<div class="card__actions">
<!-- … -->
</div>
<div class="card__description">
<span class="line _short2">Get link hdonline</span>
<span class="line _long">Giúp bạn xem phim chất lượng cao, không bị quảng cáo làm phiền</span>
</div>
</div><!-- /.card -->
<div class="card">
<div class="card__image" id="card-3">
<div class="image-overlay">
</div>
<img src="https://d39fx46bzv2q62.cloudfront.net/wp-content/uploads/2014/11/g9.jpg" alt="" />
</div>
<div class="card__actions">
<!-- … -->
</div>
<div class="card__description">
<span class="line _short3">Emotion đẹp Facebook</span>
<span class="line _long">Tạo mẫu status độc đáo, thêm Emoji ngộ nghĩnh làm sinh động Facebook của bạn.</span>
</div>
</div><!-- /.card -->
</div><!-- /.card-container -->

First: give your cards some margin (I used margin: 0 5px for 5px on the left and right) then set its width to width: calc(33.333% - 10px); where the 10px is both margins added together.
Second: Simply make your card an anchor tag <a>.
.card-container {
display: flex;
flex-wrap: wrap;
flex-direction: row;
border-radius: 4px;
overflow: hidden;
padding: 5px;
}
.card {
display: flex;
flex-direction: column;
border-radius: 4px;
align-items: left;
padding: 0 0 15px 0;
margin: 0 5px;
width: calc(33.333% - 10px);
background: #ecf0f1;
box-shadow: 0px 3px 10px 1px rgba(0, 0, 0, 0.1);
}
.card__image {
position: relative;
width: 100%;
display: block;
height: 125px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
overflow: hidden;
}
.card__image:hover {
cursor: pointer;
}
.card__image:hover:after {
bottom: 0;
color: white;
transition: all 0.15s;
}
.card__image:hover .image-overlay {
background-color: rgba(35, 155, 55, 0.33);
transition: all 0.15s;
}
.card__image:after {
display: flex;
justify-content: center;
align-items: center;
bottom: -4em;
position: absolute;
width: 100%;
height: 100%;
font-family: "FontAwesome";
font-size: 1em;
text-align: center;
content: "\f00c";
color: rgba(255, 255, 255, 0);
color: #fff;
transition: all 0.15s;
}
.card__image .image-overlay {
display: block;
position: absolute;
width: 100%;
height: 125px;
top: 0;
left: 0;
content: "";
background-color: rgba 255, 255, 255, 0;
transition: backgroundColor, 0.15s;
}
.card__image img {
display: block;
width: 100%;
}
.card__actions {
font-family: serif;
font-size: 25px;
line-height: 12px;
color: #a3a3a3;
text-align: right;
padding: 0 8px 0 0;
margin: 0;
}
span {
display: block;
border-radius: 3px;
margin: 0.5em 0.5em 0 0.5em;
color: #88888b;
}
span.line {
background: #f0f0f0;
color: #000;
margin: 0;
padding: 0.5em 0.5em;
text-align: center;
}
span._short1 {
color: #fff;
background: linear-gradient(to right, #1f4037, #99f2c8);
}
span._short2 {
color: #fff;
background: linear-gradient(to right, #fc4a1a, #f7b733);
}
span._short3 {
color: #fff;
background: linear-gradient(to right, #ec008c, #fc6767);
}
<div class="card-container card--fixedWidth">
<a href="#" class="card">
<div class="card__image" id="card-1">
<div class="image-overlay">
</div>
<img src="http://www.fubiz.net/wp-content/uploads/2014/11/Lotta-Nieminen_Google_07-640x553.jpg" alt="" />
</div>
<div class="card__actions">
<!-- … -->
</div>
<div class="card__description">
<span class="line _short1">Tải bộ cài Windows, Office chính chủ</span>
<span class="line _long">Link trực tiếp từ server Microsoft giúp bạn dễ dàng chọn bất cứ phiên bản nào!</span>
</div>
</a><!-- /.card -->
<a href="#" class="card">
<div class="card__image" id="card-2">
<div class="image-overlay">
</div>
<img src="https://s-media-cache-ak0.pinimg.com/736x/e7/f2/98/e7f298f2db462652fd8b9a1ee888458a.jpg" alt="" />
</div>
<div class="card__actions">
<!-- … -->
</div>
<div class="card__description">
<span class="line _short2">Get link hdonline</span>
<span class="line _long">Giúp bạn xem phim chất lượng cao, không bị quảng cáo làm phiền</span>
</div>
</a><!-- /.card -->
<a href="#" class="card">
<div class="card__image" id="card-3">
<div class="image-overlay">
</div>
<img src="https://d39fx46bzv2q62.cloudfront.net/wp-content/uploads/2014/11/g9.jpg" alt="" />
</div>
<div class="card__actions">
<!-- … -->
</div>
<div class="card__description">
<span class="line _short3">Emotion đẹp Facebook</span>
<span class="line _long">Tạo mẫu status độc đáo, thêm Emoji ngộ nghĩnh làm sinh động Facebook của bạn.</span>
</div>
</a><!-- /.card -->
</div><!-- /.card-container -->

You can add padding, you just need to also set the box-sizing css to border-box
.card-container {
display: flex;
flex-wrap: wrap;
flex-direction: row;
border-radius: 4px;
overflow: hidden;
padding: 5px;
}
.card {
display: flex;
flex-direction: column;
border-radius: 4px;
align-items: left;
padding: 15px;
box-sizing: border-box;
width: 33.333%;
background: #ecf0f1;
box-shadow: 0px 3px 10px 1px rgba(0, 0, 0, 0.1);
}
.card__image {
position: relative;
width: 100%;
display: block;
height: 125px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
overflow: hidden;
}
.card__image:hover {
cursor: pointer;
}
.card__image:hover:after {
bottom: 0;
color: white;
transition: all 0.15s;
}
.card__image:hover .image-overlay {
background-color: rgba(35, 155, 55, 0.33);
transition: all 0.15s;
}
.card__image:after {
display: flex;
justify-content: center;
align-items: center;
bottom: -4em;
position: absolute;
width: 100%;
height: 100%;
font-family: "FontAwesome";
font-size: 1em;
text-align: center;
content: "\f00c";
color: rgba(255, 255, 255, 0);
color: #fff;
transition: all 0.15s;
}
.card__image .image-overlay {
display: block;
position: absolute;
width: 100%;
height: 125px;
top: 0;
left: 0;
content: "";
background-color: rgba 255, 255, 255, 0;
transition: backgroundColor, 0.15s;
}
.card__image img {
display: block;
width: 100%;
}
.card__actions {
font-family: serif;
font-size: 25px;
line-height: 12px;
color: #a3a3a3;
text-align: right;
padding: 0 8px 0 0;
margin: 0;
}
span {
display: block;
border-radius: 3px;
margin: 0.5em 0.5em 0 0.5em;
color: #88888b;
}
span.line {
background: #f0f0f0;
color: #000;
margin: 0;
padding: 0.5em 0.5em;
text-align: center;
}
span._short1 {
color: #fff;
background: linear-gradient(to right, #1f4037, #99f2c8);
}
span._short2 {
color: #fff;
background: linear-gradient(to right, #fc4a1a, #f7b733);
}
span._short3 {
color: #fff;
background: linear-gradient(to right, #ec008c, #fc6767);
}
<div class="card-container card--fixedWidth">
<div class="card">
<div class="card__image" id="card-1">
<div class="image-overlay">
</div>
<img src="http://www.fubiz.net/wp-content/uploads/2014/11/Lotta-Nieminen_Google_07-640x553.jpg" alt="" />
</div>
<div class="card__actions">
<!-- … -->
</div>
<div class="card__description">
<span class="line _short1">Tải bộ cài Windows, Office chính chủ</span>
<span class="line _long">Link trực tiếp từ server Microsoft giúp bạn dễ dàng chọn bất cứ phiên bản nào!</span>
</div>
</div><!-- /.card -->
<div class="card">
<div class="card__image" id="card-2">
<div class="image-overlay">
</div>
<img src="https://s-media-cache-ak0.pinimg.com/736x/e7/f2/98/e7f298f2db462652fd8b9a1ee888458a.jpg" alt="" />
</div>
<div class="card__actions">
<!-- … -->
</div>
<div class="card__description">
<span class="line _short2">Get link hdonline</span>
<span class="line _long">Giúp bạn xem phim chất lượng cao, không bị quảng cáo làm phiền</span>
</div>
</div><!-- /.card -->
<div class="card">
<div class="card__image" id="card-3">
<div class="image-overlay">
</div>
<img src="https://d39fx46bzv2q62.cloudfront.net/wp-content/uploads/2014/11/g9.jpg" alt="" />
</div>
<div class="card__actions">
<!-- … -->
</div>
<div class="card__description">
<span class="line _short3">Emotion đẹp Facebook</span>
<span class="line _long">Tạo mẫu status độc đáo, thêm Emoji ngộ nghĩnh làm sinh động Facebook của bạn.</span>
</div>
</div><!-- /.card -->
</div><!-- /.card-container -->

Related

Issues with tooltip

I've built a modal where in the header, there's a tooltip explaining certain points to a user of the modal for clarity.
The problem I am running into is that the tooltip isn't behaving properly. The tooltip text is over lapping the modal instead of hovering above it when your cursor passes over it.
Edit* Preview of my first attempt on https://jsfiddle.net/rjfz47na/
Feature Code:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<style>
.woocommerce-MyAccount-content:not(.content-edit-account) {
float: none;
margin: 0 0 30px 0;
width: 100%;
border: 1px solid #DEDEDE;
}
.woocommerce-account {
clear: both;
}
a, a:hover {
text-decoration: none;
}
a {
color: #2ea3f2;
}
h4 {
font-family: "DIN Next Slab Pro Bold", serif;
text-transform: uppercase;
color: #1b1b1b;
padding-bottom: 0;
}
h4 {
font-size: 18px;
}
h1, h2, h3, h4, h5, h6 {
color: #333;
padding-bottom: 10px;
line-height: 1em;
font-weight: 500;
}
.woocommerce-account .ps-courses__image img {
height: auto;
width: 20px;
}
img {
max-width: 100%;
height: auto;
}
</style>
<style>
body {
align-items: center;
background: #F1EEF1;
display: flex;
font-family: sans-serif;
justify-content: center;
height: 100vh;
margin: 0;
}
.container {
align-items: center;
/* background: #F1EEF1;
border: 1px solid #D2D1D4;
*/ display: flex;
height: 365px;
justify-content: center;
width: 700px;
}
.email {
background: #DEDBDF;
border-radius: 16px;
height: 32px;
overflow: hidden;
position: relative;
width: 180px;
text-align: center;
-webkit-tap-highlight-color: transparent;
transition: width 300ms cubic-bezier(0.4, 0.0, 0.2, 1),
height 300ms cubic-bezier(0.4, 0.0, 0.2, 1),
box-shadow 300ms cubic-bezier(0.4, 0.0, 0.2, 1),
border-radius 300ms cubic-bezier(0.4, 0.0, 0.2, 1);
}
.email:not(.expand) {
cursor: pointer;
}
.email:not(.expand):hover {
background: #C2C0C2;
}
.from {
position: absolute;
transition: opacity 200ms 100ms cubic-bezier(0.0, 0.0, 0.2, 1);
}
.from-contents {
display: flex;
flex-direction: row;
transform-origin: 0 0;
transition: transform 300ms cubic-bezier(0.4, 0.0, 0.2, 1);
}
.to {
opacity: 0;
position: absolute;
transition: opacity 100ms cubic-bezier(0.4, 0.0, 1, 1);
}
.to-contents {
transform: scale(.55);
transform-origin: 0 0;
transition: transform 300ms cubic-bezier(0.4, 0.0, 0.2, 1);
}
.avatar {
border-radius: 12px;
height: 24px;
left: 18px;
position: relative;
top: -11px;
width: 85px;
}
.name {
font-size: 14px;
line-height: 32px;
width: 180px;
}
.top {
background: #2c5424;
display: flex;
flex-direction: row;
height: 70px;
transition: height 300ms cubic-bezier(0.4, 0.0, 0.2, 1);
width: 700px;
}
.avatar-large {
border-radius: 21px;
height: 42px;
margin-left: 12px;
position: relative;
top: 26px;
width: 100px;
color: #FFFFFF;
}
.name-large {
color: #ffffff;
font-size: 16px;
line-height: 70px;
margin-left: 100px;
}
.x-touch {
align-items: center;
align-self: center;
cursor: pointer;
display: flex;
height: 50px;
justify-content: center;
margin-left: auto;
width: 50px;
}
.x {
background: #ffffff;
border-radius: 10px;
height: 20px;
position: relative;
width: 20px;
}
.x-touch:hover .x {
background: #E1D9D1;
}
.line1 {
background: #2C5424;
height: 12px;
position: absolute;
transform: translateX(9px) translateY(4px) rotate(45deg);
width: 2px;
}
.line2 {
background: #2C5424;
height: 12px;
position: absolute;
transform: translateX(9px) translateY(4px) rotate(-45deg);
width: 2px;
}
.bottom {
background: #FFF;
color: #444247;
font-size: 14px;
height: 295px;
padding-top: 5px;
width: 700px;
overflow-y: auto;
}
.row {
align-items: center;
display: flex;
flex-direction: row;
height: 85px;
}
.twitter {
margin-left: 16px;
height: 30px;
position: relative;
top: 0px;
width: 30px;
}
.medium {
height: 30px;
margin-left: 16px;
position: relative;
width: 30px;
}
.link {
margin-left: 16px;
}
.link a {
color: #444247;
text-decoration: none;
}
.link a:hover {
color: #777579;
}
.email.expand {
border-radius: 6px;
box-shadow: 0 10px 20px rgba(0,0,0,0.10), 0 6px 6px rgba(0,0,0,0.16);
height: 365px;
width: 700px;
}
.expand .from {
opacity: 0;
transition: opacity 100ms cubic-bezier(0.4, 0.0, 1, 1);
}
.expand .from-contents {
transform: scale(1.91);
}
.expand .to {
opacity: 1;
transition: opacity 200ms 100ms cubic-bezier(0.0, 0.0, 0.2, 1);
}
.expand .to-contents {
transform: scale(1);
}
.p2{
padding: 0 12px;
}
/* button div */
#buttons {
padding-top: 50px;
text-align: center;
}
/* start da css for da buttons */
.btn {
border-radius: 5px;
padding: 1px 5px;
font-size: 14px;
text-decoration: none;
color: #fff;
position: relative;
display: inline-block;
cursor: pointer;
}
.btn:active {
transform: translate(0px, 5px);
-webkit-transform: translate(0px, 5px);
box-shadow: 0px 1px 0px 0px;
}
.green {
background-color: #15B358;
box-shadow: 0px 3px 0px 0px #218838;
}
.green:hover {
background-color: #28a745;
}
.red {
background-color: #e74c3c;
box-shadow: 0px 3px 0px 0px #CE3323;
}
.red:hover {
background-color: #dc3545;
}
.black {
background-color: #343a40;
box-shadow: 0px 5px 0px 0px #23272b;
font-size: 16px;
padding: 3px 12px;
}
.black:hover {
background-color: #23272b;
}
input {
border: none;
width: 170px;
height: 25px;
outline: none;
padding-left: 10px;
}
.tooltip {
position: relative;
background: #FFFFFF;
padding: 5px 10px;
margin: 5px;
font-size: 15px;
border-radius: 100%;
color: #2c5424;
animation: shake 500ms ease-in-out forwards;
}
.tooltip:before,
.tooltip:after {
position: absolute;
content: "";
opacity: 0;
transition: all 0.4s ease;
}
.tooltip:before {
border-width: 10px 8px 0 8px;
border-style: solid;
border-color: #ffffff transparent transparent transparent;
top: -15px;
transform: translateY(20px);
}
.tooltip:after {
content: attr(data-tooltip);
background: #2c5424;
width: 350px;
height: 95px;
font-size: 13px;
font-weight: 300;
top: -130px;
left: -10px;
padding: 10px;
border-radius: 5px;
letter-spacing: 1px;
transform: translateY(20px);
}
.tooltip:hover::before,
.tooltip:hover::after {
opacity: 1;
transform: translateY(-2px);
}
#keyframes shake {
0% {
transform: rotate(2deg);
}
50% {
transform: rotate(-3deg);
}
70% {
transform: rotate(3deg);
}
100% {
transform: rotate(0deg);
}
}
</style>
</head>
<body>
<div class="container">
<div class="email expand" onclick="this.classList.add('expand')">
<div class="from">
<div class="from-contents">
<div class="name">Assign Backup Cards</div>
</div>
</div>
<div class="to">
<div class="to-contents">
<div class="top">
<div class="avatar-large"><strong>HEADS UP!</strong></div>
<div class="name-large"><b>
You have <span id="card-count-total">3</span> unassigned Backup Cards.
</b>
<span class="tooltip" data-tooltip="This feature will allow you to assign your available pool of unassigned safety cards to either your course or courses you have purchased and sent out to other individuals. Once assigned, the cards will be mailed out when the course is completed.">?</span>
</div>
<div class="x-touch" onclick="document.querySelector('.email').classList.remove('expand');event.stopPropagation();">
<div class="x">
<div class="line1"></div>
<div class="line2"></div>
</div>
</div>
</div>
<div class="bottom">
<div class="row">
<div style="display: flex">
<div style="flex-shrink: 1;">
<div class="ps-courses__image">
</div>
</div>
<div style="padding-top: 26px; flex-grow: 1; flex-shrink: 0; display: grid; grid-template-columns: max-content 2fr 1fr; grid-auto-flow: column; text-align: center;">
<div style="text-align: left;padding-left: 10px;padding-bottom: 20px;">
<div> Test! Online Course </div>
<div> Voucher: HYH65-GF3C8 </div>
<div> Email: s***6#yahoo.com </div>
<a onclick="bcr_addCard('JN3SU-GF3C8')" class="btn green">Add Card</a>
<a onclick="bcr_removeCard('JN3SU-GF3C8')" class="btn red">Remove Card</a>
</div>
<div>
<span class="card-count" data-voucher="JN3SU-GF3C8">0</span> Cards
</div>
<div><b>This is your course </b></div>
</div>
</div>
</div>
<hr>
<div class="row">
<div style="display: flex">
<div style="flex-shrink: 1;">
<div class="ps-courses__image">
</div>
</div>
<div style="padding-top: 26px; flex-grow: 1; flex-shrink: 0; display: grid; grid-template-columns: max-content 2fr 1fr; grid-auto-flow: column; text-align: center;">
<div style="text-align: left;padding-left: 10px;padding-bottom: 20px;">
<div> Test! Online Course </div>
<div> Voucher: HYH65-GF3C8 </div>
<div> Email: s***6#yahoo.com </div>
<a onclick="bcr_addCard('JN3SU-GF3C8')" class="btn green">Add Card</a>
<a onclick="bcr_removeCard('JN3SU-GF3C8')" class="btn red">Remove Card</a>
</div>
<div>
<span class="card-count" data-voucher="JN3SU-GF3C8">0</span> Cards
</div>
<div><b>This is your course </b></div>
</div>
</div>
</div>
<hr>
<div class="row">
<div style="display: flex">
<div style="flex-shrink: 1;">
<div class="ps-courses__image">
</div>
</div>
<div style="padding-top: 26px; flex-grow: 1; flex-shrink: 0; display: grid; grid-template-columns: max-content 2fr 1fr; grid-auto-flow: column; text-align: center;">
<div style="text-align: left;padding-left: 10px;padding-bottom: 20px;">
<div> Test! Online Course </div>
<div> Voucher: HYH65-GF3C8 </div>
<div> Email: s***6#yahoo.com </div>
<a onclick="bcr_addCard('JN3SU-GF3C8')" class="btn green">Add Card</a>
<a onclick="bcr_removeCard('JN3SU-GF3C8')" class="btn red">Remove Card</a>
</div>
<div>
<span class="card-count" data-voucher="JN3SU-GF3C8">0</span> Cards
</div>
<div><b>This is your course </b></div>
</div>
</div>
</div>
<hr>
<div class="row">
<div style="display: flex">
<div style="flex-shrink: 1;">
<div class="ps-courses__image">
</div>
</div>
<div style="padding-top: 26px; flex-grow: 1; flex-shrink: 0; display: grid; grid-template-columns: max-content 2fr 1fr; grid-auto-flow: column; text-align: center;">
<div style="text-align: left;padding-left: 10px;padding-bottom: 20px;">
<div style="
padding-left: 0px;
"> Test! Online Course </div>
<div> Voucher: HYH65-GF3C8 </div>
<div> Email: s***6#yahoo.com </div>
<a onclick="bcr_addCard('JN3SU-GF3C8')" class="btn green">Add Card</a>
<a onclick="bcr_removeCard('JN3SU-GF3C8')" class="btn red">Remove Card</a>
</div>
<div>
<span class="card-count" data-voucher="JN3SU-GF3C8">0</span> Cards
</div>
<div><b>This is your course </b></div>
</div>
</div>
</div>
<hr>
<div class="row" style="display: flex; justify-content: center;">
Submit
</div>
</div>
</div>
</div>
</div>
</div>
</body></html>
Edit*: I'm trying to have the tooltip behave like what is seen in https://jsfiddle.net/dnu297g1/3/ while keeping the same position for the tooltip as my original attempt. Having it Beside the header of the modal on the right side.
HTML:
<form>
<div>
<span class="tooltip" data-tooltip="This feature will allow you to assign your available pool of unassigned safety cards to either your course or courses you have purchased and sent out to other individuals. Once assigned, the cards will be mailed out when the course is completed.">?</span>
</div>
</form>
CSS:
body {
background: #424B54;
font-family: "Source Sans Pro", sans-serif;
overflow: hidden;
}
form {
display: flex;
justify-content: center;
align-items: center;
position: relative;
width: 100%;
height: 100vh;
}
input {
border: none;
width: 170px;
height: 25px;
outline: none;
padding-left: 10px;
}
.tooltip {
position: relative;
background: #2c5424;
padding: 5px 12px;
margin: 5px;
font-size: 15px;
border-radius: 100%;
color: #FFF;
}
.tooltip:before,
.tooltip:after {
position: absolute;
content: "";
opacity: 0;
transition: all 0.4s ease;
}
.tooltip:before {
border-width: 10px 8px 0 8px;
border-style: solid;
border-color: #ffffff transparent transparent transparent;
top: -15px;
transform: translateY(20px);
}
.tooltip:after {
content: attr(data-tooltip);
background: #2c5424;
width: 350px;
height: 95px;
font-size: 13px;
font-weight: 300;
top: -130px;
left: -10px;
padding: 10px;
border-radius: 5px;
letter-spacing: 1px;
transform: translateY(20px);
}
.tooltip:hover::before,
.tooltip:hover::after {
opacity: 1;
transform: translateY(-2px);
}
Here is a working snippet of what you want to achieve.
I had to do some modifications on the CSS code of your tooltip class.
Moreover, I added a div tag with an id="anim" that surrounds your span tag such as in the jsfiddle you attached in your post.
What the <div id="anim"> does is to trigger the shake HTML5 animation which does a slight rotation whenever you hover over your tooltip span tag.
Hope that can help you.
#keyframes shake {
0% {
transform: rotate(2deg);
}
50% {
transform: rotate(-3deg);
}
70% {
transform: rotate(3deg);
}
100% {
transform: rotate(0deg);
}
}
.woocommerce-MyAccount-content:not(.content-edit-account) {
float: none;
margin: 0 0 30px 0;
width: 100%;
border: 1px solid #DEDEDE;
}
.woocommerce-account {
clear: both;
}
a,
a:hover {
text-decoration: none;
}
a {
color: #2ea3f2;
}
h4 {
font-family: "DIN Next Slab Pro Bold", serif;
text-transform: uppercase;
color: #1b1b1b;
padding-bottom: 0;
}
h4 {
font-size: 18px;
}
h1,
h2,
h3,
h4,
h5,
h6 {
color: #333;
padding-bottom: 10px;
line-height: 1em;
font-weight: 500;
}
.woocommerce-account .ps-courses__image img {
height: auto;
width: 20px;
}
img {
max-width: 100%;
height: auto;
}
body {
align-items: center;
background: #fff;
display: flex;
font-family: sans-serif;
justify-content: center;
height: 125vh;
margin: 0;
}
.container {
align-items: center;
display: flex;
height: 100%;
max-height: 700px;
justify-content: center;
width: 730px;
top: 100px;
position: absolute;
padding: 20px;
z-index: 0;
}
.email {
background: #DEDBDF;
border-radius: 16px;
height: 32px;
overflow: hidden;
position: relative;
width: 180px;
text-align: center;
-webkit-tap-highlight-color: transparent;
transition: width 300ms cubic-bezier(0.4, 0.0, 0.2, 1), height 300ms cubic-bezier(0.4, 0.0, 0.2, 1), box-shadow 300ms cubic-bezier(0.4, 0.0, 0.2, 1), border-radius 300ms cubic-bezier(0.4, 0.0, 0.2, 1);
}
.email:not(.expand) {
cursor: pointer;
}
.email:not(.expand):hover {
background: #C2C0C2;
}
.from {
position: absolute;
transition: opacity 200ms 100ms cubic-bezier(0.0, 0.0, 0.2, 1);
}
.from-contents {
display: flex;
flex-direction: row;
transform-origin: 0 0;
transition: transform 300ms cubic-bezier(0.4, 0.0, 0.2, 1);
}
.to {
opacity: 0;
position: absolute;
transition: opacity 100ms cubic-bezier(0.4, 0.0, 1, 1);
}
.to-contents {
transform: scale(.55);
transform-origin: 0 0;
transition: transform 300ms cubic-bezier(0.4, 0.0, 0.2, 1);
}
.avatar {
border-radius: 12px;
height: 24px;
left: 18px;
position: relative;
top: -11px;
width: 85px;
}
.name {
font-size: 14px;
line-height: 32px;
width: 180px;
}
.top {
background: #2c5424;
display: flex;
flex-direction: row;
height: 100%;
align-items: center;
transition: height 300ms cubic-bezier(0.4, 0.0, 0.2, 1);
width: 740px;
}
.avatar-large {
border-radius: 21px;
margin-left: 12px;
position: relative;
width: 100px;
color: #FFFFFF;
}
.name-large {
color: #ffffff;
font-size: 16px;
margin-left: 35px;
}
.x-touch {
align-items: center;
align-self: center;
cursor: pointer;
display: flex;
height: 50px;
justify-content: center;
margin-left: 30px;
width: 50px;
position: relative;
}
.x {
background: #ffffff;
border-radius: 10px;
height: 20px;
position: relative;
width: 20px;
}
.x-touch:hover .x {
background: #E1D9D1;
}
.line1 {
background: #2C5424;
height: 12px;
position: absolute;
transform: translateX(9px) translateY(4px) rotate(45deg);
width: 2px;
}
.line2 {
background: #2C5424;
height: 12px;
position: absolute;
transform: translateX(9px) translateY(4px) rotate(-45deg);
width: 2px;
}
.bottom {
background: #FFF;
color: #444247;
font-size: 14px;
height: 100%;
padding-top: 5px;
width: 730px;
overflow-y: auto;
}
.row {
align-items: center;
display: flex;
flex-direction: row;
height: 85px;
}
.twitter {
margin-left: 16px;
height: 30px;
position: relative;
top: 0px;
width: 30px;
}
.medium {
height: 30px;
margin-left: 16px;
position: relative;
width: 30px;
}
.link {
margin-left: 16px;
}
.link a {
color: #444247;
text-decoration: none;
}
.link a:hover {
color: #777579;
}
.email.expand {
border-radius: 6px;
box-shadow: 0 10px 20px rgb(0 0 0 / 10%), 0 6px 6px rgb(0 0 0 / 16%);
height: 100%;
width: 730px;
margin: 30px auto;
}
.expand .from {
opacity: 0;
transition: opacity 100ms cubic-bezier(0.4, 0.0, 1, 1);
}
.expand .from-contents {
transform: scale(1.91);
}
.expand .to {
opacity: 1;
transition: opacity 200ms 100ms cubic-bezier(0.0, 0.0, 0.2, 1);
}
.expand .to-contents {
transform: scale(1);
}
.p2 {
padding: 0 12px;
}
/* button div */
#buttons {
padding-top: 50px;
text-align: center;
}
/* start da css for da buttons */
.btn {
border-radius: 5px;
padding: 1px 5px;
font-size: 14px;
text-decoration: none;
color: #fff;
position: relative;
display: inline-block;
cursor: pointer;
}
.btn:active {
transform: translate(0px, 5px);
-webkit-transform: translate(0px, 5px);
box-shadow: 0px 1px 0px 0px;
}
.green {
background-color: #15B358;
box-shadow: 0px 3px 0px 0px #218838;
}
.green:hover {
background-color: #28a745;
}
.red {
background-color: #e74c3c;
box-shadow: 0px 3px 0px 0px #CE3323;
}
.red:hover {
background-color: #dc3545;
}
.black {
background-color: #343a40;
box-shadow: 0px 5px 0px 0px #23272b;
font-size: 16px;
padding: 3px 12px;
}
.black:hover {
background-color: #23272b;
}
input {
border: none;
width: 170px;
height: 25px;
outline: none;
padding-left: 10px;
}
.tooltip {
position: relative;
background: #2c5424;
padding: 5px 12px;
margin: 10px;
font-size: 15px;
line-height: 17px;
border-radius: 100%;
color: #FFF;
margin-left: 35px;
}
.tooltip:before, .tooltip:after {
position: absolute;
content: "";
opacity: 0;
transition: all 0.4s ease;
}
.tooltip:before {
border-width: 10px 8px 0 8px;
border-style: solid;
border-color: #15B358 transparent transparent transparent;
top: 40px;
transform: translateY(40px);
line-height: 12px;
position: absolute;
}
.tooltip:after {
content: attr(data-tooltip);
background: #2c5424;
width: 250px;
height: 95px;
font-size: 10px;
font-weight: 300;
top: 45px;
padding: 10px;
border-radius: 5px;
letter-spacing: 1px;
transform: translateY(20px);
position: fixed;
z-index: 10000000;
display: block;
}
.tooltip:hover::before,
.tooltip:hover::after {
opacity: 1;
transform: translateY(-2px);
}
#keyframes shake {
0% {
transform: rotate(2deg);
}
50% {
transform: rotate(-3deg);
}
70% {
transform: rotate(3deg);
}
100% {
transform: rotate(0deg);
}
}
#anim:hover {
animation: shake 500ms ease-in-out forwards;
}
form {
display: flex;
justify-content: center;
align-items: center;
position: relative;
width: 100%;
height: 100vh;
}
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<div class="container">
<div class="email expand" onclick="this.classList.add('expand')">
<div class="from">
<div class="from-contents">
<div class="name">Assign Backup Cards</div>
</div>
</div>
<div class="to">
<div class="to-contents">
<div class="top">
<div class="avatar-large"><strong>HEADS UP!</strong></div>
<div class="name-large"><b>
You have <span id="card-count-total">3</span> unassigned Backup Cards.
</b>
</div>
<div id="anim">
<span class="tooltip" data-tooltip="This feature will allow you to assign your available pool of unassigned safety cards to either your course or courses you have purchased and sent out to other individuals. Once assigned, the cards will be mailed out when the course is completed.">?</span>
</div>
<div class="x-touch" onclick="document.querySelector('.email').classList.remove('expand');event.stopPropagation();">
<div class="x">
<div class="line1"></div>
<div class="line2"></div>
</div>
</div>
</div>
<div class="bottom">
<div class="row">
<div style="display: flex">
<div style="flex-shrink: 1;">
<div class="ps-courses__image">
</div>
</div>
<div style="padding-top: 26px; flex-grow: 1; flex-shrink: 0; display: grid; grid-template-columns: max-content 2fr 1fr; grid-auto-flow: column; text-align: center;">
<div style="text-align: left;padding-left: 10px;padding-bottom: 20px;">
<div> Test! Online Course </div>
<div> Voucher: HYH65-GF3C8 </div>
<div> Email: s***6#yahoo.com </div>
<a onclick="bcr_addCard('JN3SU-GF3C8')" class="btn green">Add Card</a>
<a onclick="bcr_removeCard('JN3SU-GF3C8')" class="btn red">Remove Card</a>
</div>
<div>
<span class="card-count" data-voucher="JN3SU-GF3C8">0</span> Cards
</div>
<div><b>This is your course </b></div>
</div>
</div>
</div>
<hr>
<div class="row">
<div style="display: flex">
<div style="flex-shrink: 1;">
<div class="ps-courses__image">
</div>
</div>
<div style="padding-top: 26px; flex-grow: 1; flex-shrink: 0; display: grid; grid-template-columns: max-content 2fr 1fr; grid-auto-flow: column; text-align: center;">
<div style="text-align: left;padding-left: 10px;padding-bottom: 20px;">
<div> Test! Online Course </div>
<div> Voucher: HYH65-GF3C8 </div>
<div> Email: s***6#yahoo.com </div>
<a onclick="bcr_addCard('JN3SU-GF3C8')" class="btn green">Add Card</a>
<a onclick="bcr_removeCard('JN3SU-GF3C8')" class="btn red">Remove Card</a>
</div>
<div>
<span class="card-count" data-voucher="JN3SU-GF3C8">0</span> Cards
</div>
<div><b>This is your course </b></div>
</div>
</div>
</div>
<hr>
<div class="row">
<div style="display: flex">
<div style="flex-shrink: 1;">
<div class="ps-courses__image">
</div>
</div>
<div style="padding-top: 26px; flex-grow: 1; flex-shrink: 0; display: grid; grid-template-columns: max-content 2fr 1fr; grid-auto-flow: column; text-align: center;">
<div style="text-align: left;padding-left: 10px;padding-bottom: 20px;">
<div> Test! Online Course </div>
<div> Voucher: HYH65-GF3C8 </div>
<div> Email: s***6#yahoo.com </div>
<a onclick="bcr_addCard('JN3SU-GF3C8')" class="btn green">Add Card</a>
<a onclick="bcr_removeCard('JN3SU-GF3C8')" class="btn red">Remove Card</a>
</div>
<div>
<span class="card-count" data-voucher="JN3SU-GF3C8">0</span> Cards
</div>
<div><b>This is your course </b></div>
</div>
</div>
</div>
<hr>
<div class="row">
<div style="display: flex">
<div style="flex-shrink: 1;">
<div class="ps-courses__image">
</div>
</div>
<div style="padding-top: 26px; flex-grow: 1; flex-shrink: 0; display: grid; grid-template-columns: max-content 2fr 1fr; grid-auto-flow: column; text-align: center;">
<div style="text-align: left;padding-left: 10px;padding-bottom: 20px;">
<div style="
padding-left: 0px;
"> Test! Online Course </div>
<div> Voucher: HYH65-GF3C8 </div>
<div> Email: s***6#yahoo.com </div>
<a onclick="bcr_addCard('JN3SU-GF3C8')" class="btn green">Add Card</a>
<a onclick="bcr_removeCard('JN3SU-GF3C8')" class="btn red">Remove Card</a>
</div>
<div>
<span class="card-count" data-voucher="JN3SU-GF3C8">0</span> Cards
</div>
<div><b>This is your course </b></div>
</div>
</div>
</div>
<hr>
<div class="row" style="display: flex; justify-content: center;">
Submit
</div>
</div>
</div>
</div>
</div>
</div>
</body></html>

Why is there white space on the bottom of the web page

The white space is visible when I select a height over 20px at the last CSS Element. The
class "roadmap-box"
Near the bottom of the HTML Body Element. The top white box is the "roadmap-box" Click here to see the image
Whenever I try to adjust the height, the top white box becomes bigger, but also the white box at the bottom grows in size. I dont know how to fix that.
* {
margin: 0;
padding: 0;
font-family: sans-serif;
}
.banner {
width: 100%;
height: 100vh;
background-image: linear-gradient(rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0.5)), url(Background/3.jpg);
background-size: cover;
background-position: center;
padding-bottom: 2100px;
}
.navbar {
width: 85%;
margin: auto;
padding: 35px 0;
display: flex;
align-items: center;
justify-content: space-between;
}
.profile-signature {
width: 300px;
object-position: top;
object-fit: contain;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
}
.navbar ul li {
list-style: none;
display: inline-block;
margin: 0 20px;
position: relative;
}
.navbar ul li a {
text-decoration: none;
color: #fff;
text-transform: uppercase;
}
.navbar ul li::after {
content: '';
height: 3px;
width: 0;
background: #009688;
position: absolute;
left: 0;
bottom: -10px;
transition: 0.5s;
}
.navbar ul li:hover::after {
width: 100%;
}
.profile-picture {
border-radius: 50%;
width: 150px;
height: 150px;
object-fit: cover;
cursor: pointer;
box-shadow: 16px 16px 32px rgba(255, 255, 255, 0.3), -16px -16px 32px rgba(255, 255, 255, 0.3);
transition: 0.5s;
}
.profile-picture:hover {
width: 275px;
height: 275px;
transform: translateY(-25px);
transition: 0.5s;
}
.content {
width: 100%;
position: absolute;
top: 60;
transform: translateY(25px);
text-align: center;
color: white;
}
.content h1 {
font-size: 70px;
margin-top: 60px;
}
.content p {
margin: 20px auto;
font-weight: 100;
line-height: 25px;
}
button {
width: 200px;
padding: 15px 0;
text-align: center;
margin: 20px 10px;
border-radius: 25px;
font-weight: bold;
border: 2px solid #009688;
background: transparent;
color: white;
cursor: pointer;
position: relative;
overflow: hidden;
}
span {
background: #009688;
height: 100%;
width: 0;
border-radius: 25px;
position: absolute;
left: 0;
bottom: 0;
z-index: -1;
transition: 0.5s;
}
button:hover span {
width: 100%;
}
button:hover {
border: none
}
.text-box {
height: 600px;
border: 3px;
border-style: none;
border-color: rgba(255, 255, 255, 0.3);
transform: translateY(500px);
display: flex;
justify-content: space-around;
}
.images-box1 {
background-color: rgba(68, 218, 185, 0.05);
border-radius: 77px;
width: 375px;
height: 628px;
border: 5px;
border-color: #1f534f;
border-style: solid none;
align-items: center;
cursor: pointer;
z-index: -1;
transition: 0.7s;
}
.images-box1:hover {
background: rgb(152, 152, 152);
background: linear-gradient(3deg, rgba(152, 152, 152, 0) 0%, rgba(255, 255, 255, 0.3113620448179272) 100%);
height: 300px;
margin-top: 20px;
background: #009688;
transition: 0.7s;
}
.text-image {
border-radius: 75px;
width: 375px;
height: 300px;
display: flex;
justify-content: left;
align-items: center;
flex-direction: column;
object-fit: cover;
object-position: middle;
}
.text-title-box1 {
text-align: start;
margin-top: 10px;
text-align: center;
}
p {
padding-top: 20px;
transition: 0.5s;
}
p:hover {
transition: 0.5s;
}
.bottom-parent {
position: relative;
}
.bottom {
display: block;
width: 100%;
position: absolute;
bottom: 0;
height: 45px;
background-color: rgb(21, 105, 87);
}
.text-bottom {
display: flex;
justify-content: center;
text-indent: 20px;
padding-right: 20px;
padding-top: 13px;
color: white;
}
.twitter-hover {
text-decoration: none;
color: white;
}
.twitter-hover:hover {
text-decoration: underline;
color: rgba(255, 255, 255, 0.685);
}
.linkedin-hover {
text-decoration: none;
color: white;
}
.linkedin-hover:hover {
text-decoration: underline;
color: rgba(255, 255, 255, 0.685);
}
.instagram-hover {
text-decoration: none;
color: white;
}
.instagram-hover:hover {
text-decoration: underline;
color: rgba(255, 255, 255, 0.685);
}
.impressum:hover {
cursor: pointer;
text-decoration: underline;
color: rgba(255, 255, 255, 0.685);
}
.roadmap-box {
width: 100%;
height: 50px;
background-color: white;
transform: translateY(-500px);
}
<div class="banner">
<div class="navbar">
<img class="profile-signature" src="Logo/logo-1.png" alt="Profile Logo">
<ul>
<li>HOME</li>
<li>PORTFOLIO</li>
<li>GAMES</li>
<li>SOCIALS</li>
<li>CONTACT</li>
</ul>
</div>
<div class="content">
<a href="https://google.com/" target="_blank">
<img class="profile-picture" src="Logo/logo-2.jpg" alt="Profile Picture">
</a>
<h1>WELCOME TO PARADISE!</h1>
<p>This is a practice website. There's just a bit of text here to fill the lines, blah blah blah.
<br>If you want to know more about me, just have a look around</p>
<div>
<a href="https://google.com/" target="_blank">
<button type="button" href="#middle"><span></span>PORTFOLIO</button>
</a>
<a href="https://twitter.com/" target="_blank">
<button type="button"><span></span>SOCIALS</button>
</a>
</div>
<div class="text-box">
<div class="images-box1">
<img src="designs/1.jpg" class="text-image">
<div>
<h2 class="text-title-box1">Random Design 1</h1>
<p></p>
</div>
</div>
<div class="images-box1">
<img src="designs/2.jpg" class="text-image">
<div>
<h2 class="text-title-box1">Fantasy Shower</h1>
<p>Well, nothing much to explain here. <br> <br> I need some text so have run reading <br> blah blah blah again <br> <br>:)</p>
</div>
</div>
<div class="images-box1">
<img src="designs/3.jpg" class="text-image">
<div>
<h2 class="text-title-box1">Light Bulb Girl</h1>
<p>This image was created 2020. <br> It shows a person beeing stuck inside a lightbulb. Funny right? No deeper <br> intentions, dont look for them, <br> lol</p>
</div>
</div>
<div class="images-box1">
<img src="designs/4.jpg" class="text-image">
<div>
<h2 class="text-title-box1">Random Design 4</h1>
<p>Test</p>
</div>
</div>
</div>
</div>
</div>
<div class="code-image-box">
<div class="code-image">
</div>
</div>
<div class="roadmap-box">
<div class="q1"></div>
<div class="q2"></div>
</div>
<div class="bottom-parent">
<div class="bottom">
<div class="text-bottom">
<a class="twitter-hover" href="https:/twitter.com/" target="_blank">
<div class="twitter">Twitter</div>
</a>
<a class="linkedin-hover" href="https:/linkedin.com/" target="_blank">
<div class="linkedin">LinkedIn</div>
</a>
<a class="instagram-hover" href="https:/instagram.com/" target="_blank">
<div class="instagram">Instagram</div>
</a>
<div class="impressum">Impressum</div>
</a>
</div>
</div>
</div>
The div with class .roadmap-box has been translatedY(-500px) but the browser has still made the space available for it as it's a block-level element. If you hide it then the gap disappears. What's the purpose of it? What are you trying to do with it?
See example below. There's also no need to make .bottom position:absoute as it then gives the div .bottom-parent no height. See modified markup below.
* {
margin: 0;
padding: 0;
font-family: sans-serif;
}
.banner {
width: 100%;
height: 100vh;
background-image: linear-gradient(rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0.5)), url(Background/3.jpg);
background-size: cover;
background-position: center;
padding-bottom: 2100px;
}
.navbar {
width: 85%;
margin: auto;
padding: 35px 0;
display: flex;
align-items: center;
justify-content: space-between;
}
.profile-signature {
width: 300px;
object-position: top;
object-fit: contain;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
}
.navbar ul li {
list-style: none;
display: inline-block;
margin: 0 20px;
position: relative;
}
.navbar ul li a {
text-decoration: none;
color: #fff;
text-transform: uppercase;
}
.navbar ul li::after {
content: '';
height: 3px;
width: 0;
background: #009688;
position: absolute;
left: 0;
bottom: -10px;
transition: 0.5s;
}
.navbar ul li:hover::after {
width: 100%;
}
.profile-picture {
border-radius: 50%;
width: 150px;
height: 150px;
object-fit: cover;
cursor: pointer;
box-shadow: 16px 16px 32px rgba(255, 255, 255, 0.3), -16px -16px 32px rgba(255, 255, 255, 0.3);
transition: 0.5s;
}
.profile-picture:hover {
width: 275px;
height: 275px;
transform: translateY(-25px);
transition: 0.5s;
}
.content {
width: 100%;
position: absolute;
top: 60;
transform: translateY(25px);
text-align: center;
color: white;
}
.content h1 {
font-size: 70px;
margin-top: 60px;
}
.content p {
margin: 20px auto;
font-weight: 100;
line-height: 25px;
}
button {
width: 200px;
padding: 15px 0;
text-align: center;
margin: 20px 10px;
border-radius: 25px;
font-weight: bold;
border: 2px solid #009688;
background: transparent;
color: white;
cursor: pointer;
position: relative;
overflow: hidden;
}
span {
background: #009688;
height: 100%;
width: 0;
border-radius: 25px;
position: absolute;
left: 0;
bottom: 0;
z-index: -1;
transition: 0.5s;
}
button:hover span {
width: 100%;
}
button:hover {
border: none
}
.text-box {
height: 600px;
border: 3px;
border-style: none;
border-color: rgba(255, 255, 255, 0.3);
transform: translateY(500px);
display: flex;
justify-content: space-around;
}
.images-box1 {
background-color: rgba(68, 218, 185, 0.05);
border-radius: 77px;
width: 375px;
height: 628px;
border: 5px;
border-color: #1f534f;
border-style: solid none;
align-items: center;
cursor: pointer;
z-index: -1;
transition: 0.7s;
}
.images-box1:hover {
background: rgb(152, 152, 152);
background: linear-gradient(3deg, rgba(152, 152, 152, 0) 0%, rgba(255, 255, 255, 0.3113620448179272) 100%);
height: 300px;
margin-top: 20px;
background: #009688;
transition: 0.7s;
}
.text-image {
border-radius: 75px;
width: 375px;
height: 300px;
display: flex;
justify-content: left;
align-items: center;
flex-direction: column;
object-fit: cover;
object-position: middle;
}
.text-title-box1 {
text-align: start;
margin-top: 10px;
text-align: center;
}
p {
padding-top: 20px;
transition: 0.5s;
}
p:hover {
transition: 0.5s;
}
.bottom-parent {
position: relative;
}
.bottom {
display: block;
width: 100%;
/* position: absolute; */
bottom: 0;
height: 45px;
background-color: rgb(21, 105, 87);
}
.text-bottom {
display: flex;
justify-content: center;
text-indent: 20px;
padding-right: 20px;
padding-top: 13px;
color: white;
}
.twitter-hover {
text-decoration: none;
color: white;
}
.twitter-hover:hover {
text-decoration: underline;
color: rgba(255, 255, 255, 0.685);
}
.linkedin-hover {
text-decoration: none;
color: white;
}
.linkedin-hover:hover {
text-decoration: underline;
color: rgba(255, 255, 255, 0.685);
}
.instagram-hover {
text-decoration: none;
color: white;
}
.instagram-hover:hover {
text-decoration: underline;
color: rgba(255, 255, 255, 0.685);
}
.impressum:hover {
cursor: pointer;
text-decoration: underline;
color: rgba(255, 255, 255, 0.685);
}
.roadmap-box {
width: 100%;
height: 50px;
background-color: white;
display: none;
/*transform: translateY(-500px);*/
}
<div class="banner">
<div class="navbar">
<img class="profile-signature" src="Logo/logo-1.png" alt="Profile Logo">
<ul>
<li>HOME</li>
<li>PORTFOLIO</li>
<li>GAMES</li>
<li>SOCIALS</li>
<li>CONTACT</li>
</ul>
</div>
<div class="content">
<a href="https://google.com/" target="_blank">
<img class="profile-picture" src="Logo/logo-2.jpg" alt="Profile Picture">
</a>
<h1>WELCOME TO PARADISE!</h1>
<p>This is a practice website. There's just a bit of text here to fill the lines, blah blah blah.
<br>If you want to know more about me, just have a look around
</p>
<div>
<a href="https://google.com/" target="_blank">
<button type="button" href="#middle"><span></span>PORTFOLIO</button>
</a>
<a href="https://twitter.com/" target="_blank">
<button type="button"><span></span>SOCIALS</button>
</a>
</div>
<div class="text-box">
<div class="images-box1">
<img src="designs/1.jpg" class="text-image">
<div>
<h2 class="text-title-box1">Random Design 1</h1>
<p></p>
</div>
</div>
<div class="images-box1">
<img src="designs/2.jpg" class="text-image">
<div>
<h2 class="text-title-box1">Fantasy Shower</h1>
<p>Well, nothing much to explain here. <br> <br> I need some text so have run reading <br> blah blah blah again <br> <br>:)</p>
</div>
</div>
<div class="images-box1">
<img src="designs/3.jpg" class="text-image">
<div>
<h2 class="text-title-box1">Light Bulb Girl</h1>
<p>This image was created 2020. <br> It shows a person beeing stuck inside a lightbulb. Funny right? No deeper <br> intentions, dont look for them, <br> lol</p>
</div>
</div>
<div class="images-box1">
<img src="designs/4.jpg" class="text-image">
<div>
<h2 class="text-title-box1">Random Design 4</h1>
<p>Test</p>
</div>
</div>
</div>
</div>
</div>
<div class="code-image-box">
<div class="code-image">
</div>
</div>
<div class="roadmap-box">
<div class="q1"></div>
<div class="q2"></div>
</div>
<div class="bottom-parent">
<div class="bottom">
<div class="text-bottom">
<a class="twitter-hover" href="https:/twitter.com/" target="_blank">
<div class="twitter">Twitter</div>
</a>
<a class="linkedin-hover" href="https:/linkedin.com/" target="_blank">
<div class="linkedin">LinkedIn</div>
</a>
<a class="instagram-hover" href="https:/instagram.com/" target="_blank">
<div class="instagram">Instagram</div>
</a>
<div class="impressum">Impressum</div>
</a>
</div>
</div>
</div>

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

how to get circular menu (incl. hover + link functionality) fully responsive?

I am trying to get a circular menu (incl. hover + link functionality) to behave fully responsible.
The hovering and linking part basically is working fine.
Without the hovering part, the circular menu behaves responsive.
But with the hovering part included, the menu gets squeezed when display/screen width is adjusted.
I have tried the #media approach, setting different width and height in .ch-grid li for different screen widths, but that is not to be considered as a true solution, is merely a temporary workaround.
ul,
li {
list-style: none;
margin: 0;
padding: 0;
}
#test1 {
display: -webkit-flex;
display: flex;
text-align: center;
justify-content: space-between;
margin-bottom: 30px;
margin-left: 35px;
margin-right: 35px;
}
#test2 {
width: 15%;
text-align: center;
position: relative;
border-radius: 50%;
overflow: hidden;
background-color: #ff0082;
}
ul li img {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
object-fit: cover;
}
.ch-grid:after,
.ch-item:before {
content: '';
display: table;
}
.ch-grid:after {
clear: both;
}
.ch-grid li {
width: 220px;
height: 90px;
display: inline-block;
}
.ch-item {
width: 100%;
height: 100%;
border-radius: 50%;
overflow: hidden;
position: relative;
cursor: default;
box-shadow: inset 0 0 0 16px rgba(255, 255, 255, 0.6), 0 1px 2px rgba(0, 0, 0, 0.1);
transition: all 0.4s ease-in-out;
}
.ch-info {
position: absolute;
background: rgba(63, 147, 147, 0.8);
width: inherit;
height: inherit;
border-radius: 50%;
overflow: hidden;
opacity: 0;
transition: all 0.4s ease-in-out;
transform: scale(0);
}
.ch-info p {
color: #fff;
padding: 13px 0px;
font-style: normal;
font-size: 9px;
border-top: 1px solid rgba(255, 255, 255, 0.5);
opacity: 0;
transition: all 1s ease-in-out 0.4s;
}
.ch-info p a {
display: block;
color: rgba(255, 255, 255, 0.7);
font-style: normal;
font-weight: 700;
font-size: 140%;
letter-spacing: 1px;
padding-top: 4px;
font-family: 'Open Sans', Arial, sans-serif;
}
.ch-info p a:hover {
color: rgba(255, 242, 34, 0.8);
}
.ch-item:hover {
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 1px 2px rgba(0, 0, 0, 0.1);
}
.ch-item:hover .ch-info {
transform: scale(1);
opacity: 1;
}
.ch-item:hover .ch-info p {
opacity: 1;
}
<ul id="test1" class="ch-grid">
<li id="test2">
<div class="ch-item">
<img src="https://gespreksmakers.nl/images/1_hansie_hansumus.jpg" />
<div class="ch-info">
<p>Hansie<BR>Hansumus</p>
</div>
</div>
</li>
<li id="test2">
<div class="ch-item">
<img src="https://gespreksmakers.nl/images/1_missie_marble.jpg" />
<div class="ch-info">
<p>Missie<BR>Marble</p>
</div>
</div>
</li>
<li id="test2">
<div class="ch-item">
<img src="https://gespreksmakers.nl/images/1_piotr_linski.jpg" />
<div class="ch-info">
<p>Piotr<BR>Linski</p>
</div>
</div>
</li>
<li id="test2">
<div class="ch-item">
<img src="https://gespreksmakers.nl/images/1_red.jpg" />
<div class="ch-info">
<p>Mister<BR>Red</p>
</div>
</div>
</li>
<li id="test2">
<div class="ch-item">
<img src="https://gespreksmakers.nl/images/1_green.jpg" />
<div class="ch-info">
<p>Miss<BR>Green</p>
</div>
</div>
</li>
<li id="test2">
<div class="ch-item">
<img src="https://gespreksmakers.nl/images/1_blue.jpg" />
<div class="ch-info">
<p>Mister<BR>Blue</p>
</div>
</div>
</li>
</ul>
A fiddle, showing the present CSS- and HTML-code can be found here: https://jsfiddle.net/piotrlinski/b3tL9v4h/8/
Any suggestions how to solve?
The class attribute can be used with multiple HTML elements/tags and
all will take the effect. Where as the id is meant for a single
element/tag and is considered unique. Moreoever the id has a higher
specificity value than the class.
Responsive image:
.img-responsive {
display: block;
max-width: 100%;
height: auto;
}
An unordered list:
<ul class="thumbnails">
<li>Thumbnail 1</li>
<li>Thumbnail 2</li>
<li>...</li>
</ul>
List unstyled in one line with display: flex:
.thumbnails {
display: flex;
list-style: none;
...
}
Structure of a thumbnail
<a href="https://nkbv.nl" class="thumbnail">
<img src = "https://gespreksmakers.nl/images/1_hansie_hansumus.jpg"/>
<div class="overlay">
<p class="text">Mister White</p>
</div>
</a>
where .thumbnail has position: relative and .overlay has position: absolute so that .overlay is in the same area as .thumbnail.
Make font size responsive with vw.
A modified and clear solution
.thumbnails {
display: flex;
list-style: none;
padding: 0 2vw;
}
.thumbnails>li {
flex: 1 0;
margin: 0 5px;
text-align: center;
line-height: 0;
}
.thumbnail,
.thumbnail>img,
.thumbnail>.overlay {
border-radius: 50%;
}
.thumbnail {
position: relative;
display: inline-block;
cursor: pointer;
}
/* Responsive images */
.thumbnail>img {
display: block;
max-width: 100%;
height: auto;
}
.thumbnail>.overlay {
background: rgba(63, 147, 147, 0.8);
opacity: 0.7;
position: absolute;
top: 0;
height: 100%;
width: 100%;
transform: scale(0);
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
transition: all 0.4s ease-in-out;
}
.thumbnail>.overlay>.text {
color: white;
width: 66.66%;
line-height: 100%;
margin: 0 auto;
padding: 5px 0;
border-bottom: 1px solid;
border-top: 1px solid;
font-size: 1.85vw;
transition: opacity 1s ease-in-out 0.4s;
opacity: 0;
}
.thumbnail:hover>.overlay {
transform: scale(1);
}
.thumbnail:hover>.overlay>.text {
opacity: 1;
}
<ul class="thumbnails">
<li>
<a href="https://nkbv.nl" class="thumbnail">
<img src="https://gespreksmakers.nl/images/1_hansie_hansumus.jpg" />
<div class="overlay">
<p class="text">Mister White</p>
</div>
</a>
</li>
<li>
<a href="https://kakivi.de" class="thumbnail">
<img src="https://gespreksmakers.nl/images/1_missie_marble.jpg" />
<div class="overlay">
<p class="text">Mister White</p>
</div>
</a>
</li>
<li>
<a href="https://telegraaf.nl" class="thumbnail">
<img src="https://gespreksmakers.nl/images/1_piotr_linski.jpg" />
<div class="overlay">
<p class="text">Mister White</p>
</div>
</a>
</li>
<li>
<a href="https://www.tukhut.nl" class="thumbnail">
<img src="https://gespreksmakers.nl/images/1_red.jpg" />
<div class="overlay">
<p class="text">Mister White</p>
</div>
</a>
</li>
<li>
<a href="https://www.alumnei.nl" class="thumbnail">
<img src="https://gespreksmakers.nl/images/1_green.jpg" />
<div class="overlay">
<p class="text">Mister White</p>
</div>
</a>
</li>
<li>
<a href="https://www.astronieuws.nl" class="thumbnail">
<img src="https://gespreksmakers.nl/images/1_blue.jpg" />
<div class="overlay">
<p class="text">Mister White</p>
</div>
</a>
</li>
</ul>
You may check my code below though I have made kind of lots of changes.
Some tips:
IDs must be unique in the HTML document, so you should not use an ID more than once (e.g. #test2).
Also, it is better to use the classes you created to style your document, rather than the IDs (e.g. #test1, #test2 could be replaced by .ch-grid and .ch-grid li, respectively).
<style>
ul,
li {
list-style: none;
margin: 0;
padding: 0;
}
.ch-grid {
display: -webkit-flex;
display: flex;
flex-wrap: wrap;
text-align: center;
}
.ch-grid:after,
.ch-item:before {
content: "";
display: table;
}
.ch-grid:after {
clear: both;
flex: auto;
}
.ch-grid li {
flex: 1;
display: inline-block;
min-width: calc(100% / 6);
max-width: calc(100% / 6);
position: relative;
background-color: #ff0082;
overflow: hidden;
border-radius: 50%;
text-align: center;
}
.ch-grid li img {
width: 100%;
height: 100%;
object-fit: cover;
position: relative;
z-index: 10;
}
.ch-item {
position: relative;
width: 100%;
height: 100%;
border-radius: 50%;
overflow: hidden;
cursor: default;
box-shadow: inset 0 0 0 16px rgba(255, 255, 255, 0.6),
0 1px 2px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease-in-out;
}
.ch-info {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: -webkit-flex;
display: flex;
flex-direction: column;
justify-content: center;
background: rgba(63, 147, 147, 0.8);
border-radius: 50%;
overflow: hidden;
opacity: 0;
transition: all 0.4s ease-in-out;
transform: scale(0);
z-index: 20;
}
.ch-info p {
color: #fff;
padding: 13px 0px;
font-style: normal;
font-size: 9px;
border-top: 1px solid rgba(255, 255, 255, 0.5);
opacity: 0;
transition: all 1s ease-in-out 0.4s;
}
.ch-info p a {
display: block;
color: rgba(255, 255, 255, 0.7);
font-style: normal;
font-weight: 700;
font-size: 140%;
letter-spacing: 1px;
padding-top: 4px;
font-family: "Open Sans", Arial, sans-serif;
}
.ch-info p a:hover {
color: rgba(255, 242, 34, 0.8);
}
.ch-item:hover {
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1),
0 1px 2px rgba(0, 0, 0, 0.1);
}
.ch-item:hover .ch-info {
transform: scale(1);
opacity: 1;
}
.ch-item:hover .ch-info p {
opacity: 1;
}
#media (max-width: 767px) {
.ch-grid li {
min-width: calc(100% / 3);
max-width: calc(100% / 3);
}
}
</style>
If you set width over percentage, the list items will not seem as a circle depending the screen width. Because of this situation, you should set fixed width to the list items and set wrap to parent as you can see below:
#test1 {
display: -webkit-flex;
display: flex;
text-align: center;
justify-content: space-between;
flex-wrap: wrap;
margin-bottom: 30px;
margin-left: 35px;
margin-right: 35px;
}
#test2 {
flex-basis: 85px;
text-align: center;
position: relative;
border-radius: 50%;
overflow: hidden;
background-color: #ff0082;
}

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>