Control the position of item in css - html

I have a problem .. The blue-colored elements appear vertically, but I want them to appear horizontally .. I tried all the methods and did not solve the problem .. The code is too long, so I will only put the code of items
#cv .cv-item{
width: 499px;
height: 400px;
flex-basis: 80%;
display: inline-block;
align-items: flex-start;
justify-content: center;
flex-direction: column;
padding: 30px;
border-radius: 10px;
background-color: aqua;
background-size: cover;
margin: 10px 5%;
position: relative;
z-index: 1;
}
#cv .cv-item::after{
content: '';
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 100%;
z-index: -1;
}
Whoever wants the code details I will put it
Edit: It worked .. Unlimited thanks to everyone who tried with me .. Thank you

Change the rule for #cv .cv-buttom to this:
#cv .cv-buttom{
display: flex;
margin-top: 50px;
}
#import url('https://fonts.googleapis.com/css2?family=Lato:wght#700&display=swap');
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
html{
font-size: 10px;
font-family: 'Lato',sans-serif ;
}
a {
text-decoration: none;
}
p{
color: white;
text-align: left;
font-size: 1.4rem;
line-height: 1.9rem;
}
.container{ /* وضع العناصر في الوسط توسيط */
min-height: 100vh;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
/* hero section*/
#hero{
background-image: url(./image/michael-d-beckwith-cLOgf_7PjJs-unsplash.jpg); /* وضع صورة عبارة عن خلفية*/
background-size: cover;
background-position:top center;
position: relative;
z-index: 1;
}
#hero::after{
content: '';
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 100%;
background-color: black;
opacity: .4;
z-index: -1;
}
#hero .hero {
max-width: 1200px;
margin: 0 auto;
padding: 0 50px;
justify-content: flex-start;
}
#hero h1{
display: block;
width: fit-content;
font-size: 4rem;
position: relative;
color: transparent;
animation: text_reveal .5s ease forwards; /* استدعاء الدالة */
animation-delay: 1s;
}
#hero h1:nth-child(1) {
animation-delay: 1s;
}
#hero h1:nth-child(2) {
animation-delay: 2s;
}
#hero h1:nth-child(3) {
animation: text_reveal_name .5s ease forwards;
animation-delay: 3s;
}
#hero h1 span{ /* فهاد الحالة راح يديرهم في وسط بوكس لون تاعو واضح */
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 0;
background-color: #fddb3a;
animation: text_reveal_box 1s ease;
}
#hero .cta{
display: inline-block; /* يفرق بين العناصر يخلي فراغ*/
padding: 10px 30px;/*يخلي فراغ في الحواف لولة في الاطراف و الفوق */
color: white;
background-color: transparent;
border: 2px solid #fddb3a;
font-size: 2rem;
text-transform: uppercase;
letter-spacing: .1rem;
margin-top: 30px; /* يبغد البوتون على النص لي لفوق */
transition: .5s ease; /* يخلي مدة زمنية بين التغيير الهوفر */
transition-property:background-color,color ;
}
#hero .cta:hover{ /* تاثيرات عند وضع زر الفأرة*/
color: black;
background-color:#fddb3a;
}
/*end of hero section */
/* key frame */
#keyframes text_reveal_box{
50%{
width: 100%;
left: 0;
}
100%{
width:0;
left: 100%;
}
}
#keyframes text_reveal{
100%{
color: white;
}
}
#keyframes text_reveal_name { /* كي يحدث تغيير يخلي اللون تع الكلمة المحددة اصفر */
100% {
color: #fddb3a;
font-weight: 500;
}
}
/* end key frame */
/* cv section */
#cv .cv{
flex-direction: column; /* كانو عموديا درك يولي افقيا */
text-align: center;
max-width: 150px;
margin: 0 auto;
padding: 100px 0;
}
#cv .cv-top{
font-size: 1.4rem;
margin-top: 5px;
line-height: 2.5rem;
font-weight: 300px;
letter-spacing: .05rem;
}
#cv .section-title{
font-size: 4rem;
font-weight: 300;
color: black;
margin-bottom: 10px;
text-transform: uppercase;
letter-spacing: .2rem;
text-align: center;
}
#cv .cv-buttom{
display: flex;
margin-top: 50px;
}
#cv .cv-item{
width: 499px;
height: 400px;
flex-basis: 80%;
display: inline-block;
align-items: flex-start;
justify-content: center;
flex-direction: column;
padding: 30px;
border-radius: 10px;
background-color: aqua;
background-size: cover;
margin: 10px 5%;
position: relative;
z-index: 1;
}
#cv .cv-item::after{
content: '';
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 100%;
z-index: -1;
}
.cv .cv-buttom .icon{
height: 80px;
width: 80px;
margin-bottom: 20px;
display: inline-block;
}
#cv .cv-item h2{
font-size: 2rem;
color: white;
margin-bottom: 10px;
text-transform: uppercase;
}
#cv .cv-buttom .icon img{
height: 100%;
width: 100%;
object-fit: cover;
}
#cv .cv-item p {
color: white;
text-align: left;
}
#cv .cv-top p{
padding-top: 12px;
text-align: center;
color: black;
}
/* endof cv section */
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>My website</title>
</head>
<body>
<!-- Hero Section -->
<section id="hero">
<div class="hero container">
<div>
<h1>Hello <span></span></h1>
<h1>My name is <span></span></h1>
<h1>Smahi <span></span></h1>
Enter
</div>
</div>
</section>
<!-- End of hero section-->
<!-- Cv section-->
<section id="cv">
<div class="cv container">
<div class="cv-top">
<h1 class="section-title">CV</h1>
<p>Hello and welcome , My name is Rizki Samahi, and I am 19 years old, and I was born in Al-Qarara in the state of Ghardaia. I study automated media at the University of Ghardaia</p>
</div>
<div class="cv-buttom">
<div class="cv-item">
<div class="icon"><img src="https://img.icons8.com/nolan/64/information.png"/></div>
<h2>Pesonel information</h2>
<p>Name : Rezgui</p>
<p>Surname : Smahi</p>
<p>Adresse : Hai El MoudjahidineHai El MoudjahidineHai El MoudjahidineHai El MoudjahidineHai El Moudjahidine</p>
<p>Age : 19</p>
</div>
<div class="cv-item">
<div class="icon"><img src="https://img.icons8.com/nolan/64/information.png"/></div>
<h2>Pesonel information</h2>
<p>Name : Rezgui</p>
<p>Surname : Smahi</p>
<p>Adresse : Hai El Moudjahidine</p>
<p>Age : 19</p>
</div>
<div class="cv-item">
<div class="icon"><img src="https://img.icons8.com/nolan/64/information.png"/></div>
<h2>Pesonel information</h2>
<p>Name : Rezgui</p>
<p>Surname : Smahi</p>
<p>Adresse : Hai El Moudjahidine</p>
<p>Age : 19</p>
</div>
</div>
</div>
</section>
<!-- End of cv section-->
</body>
</html>

"flex-direction: column;" creates a vertical stack of items. Change this to "Row" and ensure you're using "Display: flex" as well instead of "inline-block."

try float:
#cv {
overflow: hidden;
}
#cv .cv-item{
width: 200px;
height: 200px;
flex-basis: 80%;
float: left;
align-items: flex-start;
justify-content: center;
flex-direction: column;
padding: 30px;
border-radius: 10px;
background-color: aqua;
background-size: cover;
margin: 10px;
position: relative;
z-index: 1;
}
#cv .cv-item::after{
content: '';
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 100%;
z-index: -1;
}
<div id="cv">
<div class="cv-item"></div>
<div class="cv-item"></div>
<div class="cv-item"></div>
</div>

Change your css rule:
#cv .cv-buttom {
display: flex;
margin-top: 50px;
}

Related

How to make rolling item animation?

body {
margin: 0px;
}
.items_container {
display: flex;
align-items: center;
width: 100%;
height: 50px;
background-color: rgb(200,200,200);
}
.circle_container {
display: flex;
align-items: center;
position: relative;
z-index: 100;
}
.circle {
position: absolute;
margin: 0px 10px;
border: 0.5px solid black;
width: 50px;
height: 50px;
border-radius: 50%;
background-color: black;
}
.btext {
padding: 0px;
margin: 0px;
color: white;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
hr {
position: absolute;
width: 100%;
z-index: 90;
}
.finish_container {
display: flex;
justify-content: flex-end;
align-items: center;
position: relative;
width: 100%;
z-index: 95;
}
.finish {
position: absolute;
margin: 0px 10px;
border: 0.5px solid black;
width: 50px;
height: 50px;
border-radius: 50%;
background-color: white;
}
.wtext {
padding: 0px;
margin: 0px;
color: black;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
<div class="items_container">
<div class="circle_container">
<div class="circle">
<p class="btext">
Start
</p>
</div>
</div>
<hr>
<div class="finish_container">
<div class="finish">
<p class="wtext">
Finish
</p>
</div>
</div>
</div>
I want to roll black (start) circle to the white (finish) circle with smooth animation. Is it possible to make this? If it is, how can i do that?
![Do not mind this sentence. System gives an error that says 'It looks like your post is mostly code; please add some more details.' For posting my question I am adding this, sorry.]!
<div classname="rotate"></div>
#keyframes anirotate {
0% {
transform: translateX(0) rotate(0);
}
100%{
transform: translateX(100px) rotate(360deg);
}
}
.rotate::after{
content: 'Start'
}
.rotate{
width : 200px;
height: 200px;
border-radius: 50%;
background-color: lightblue;
animation : anirotate 2s 0s 1 forwards;
}

breaking the design when minimizing the screen

when the screen gets smaller on my website, the elements go to irrelevant places. I did some research and thought I could remove it using '%' but it didn't work.
This is 1 scale:
This is 0.25 scale
/*my container*/
.container-home{
width: 100%;
height: 60rem;
display: flex;
align-items: center;
}
/*
the articles are here*/
.words {
display: flex;
flex-direction: column;
justify-content: center;
width: 60%;
height: 100vh;
margin-left: 25vh;
transition: 1.5s;
}
.header{
font-size: 5rem;
font-weight: 500;
}
.description {
display: block;
margin-top: 3rem;
font-size: 2rem;
}
/*explore text span*/
.explore{
margin-top: 2.5rem;
width: 15rem;
height: 4rem;
text-align: center;
display: block;
font-size: 2rem;
border: 0.1rem solid #000;
border-radius: 2.5rem;
margin-left: 1.5rem;
position: relative;
z-index: 1;
}
/*explore text a*/
.explore a{
display: block;
text-decoration: none;
font-size: 2rem;
color: #000;
text-align: center;
margin-top: 0.7rem;
}
.explore:hover {
border-color: transparent;
text-align: center;
transition: 1s;
transform: translateY(0.6rem) translateX(-1rem);
}
/*colored rectangle under text explore*/
.explore-hover{
display: inline;
position: absolute;
width: 15rem;
height: 4rem;
border-radius: 2.5rem;
background-color: #f1e0d4;
top: 42rem;
}
/*circle , solid circle and image in this*/
.image-design{
width: 100%;
height:100vh;
}
.circle{
position: relative;
width: 100%;
height: 100%;
clip-path: circle(300px at center);
background-color: #d7e7f1;
margin-top:8rem;
}
.solid-circle{
position: absolute;
width: 60rem;
height: 60rem;
border-radius: 50%;
background-color: transparent;
top: 30%;
left: 28%;
border: 1px solid #3398d7;
}
/*I created it to put an image on top of the circles*/
.conainer-image-design{
position: absolute;
width: 100%;
left: 25rem;
height:100vh;
}
.image{
position: relative;
top: 25%;
left: 12%;
}
<div class="container-home">
<div class="words">
<span class="header">
Handcrafted<br>
& ethically sourced
</span>
<span class="description">A collection inspired by old-world charm, crafted
<br>with moisannites and diamonds.
</span>
<span class="explore">Explore→</span>
<div class="explore-hover"></div>
</div>
<div class="image-design">
<div class="conainer-image-design">
<div class="circle"></div>
<div class="solid-circle"></div>
</div>
<span class="image"><img src="./ring.png"></span>
</div>
</div>
what do you recommend to give the measurements, I mainly use rem or % .which is better to keep the image intact?

Flex items are not shrinking [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I am trying to shrink upload-container and img-vector when the screen size is reduced but it seems that the upload container is not shrinking in size. I am new to CSS and I am unable to figure out the problem.
Link to my pen
body,
#main-container,
.upload-container,
.drop-zone {
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
body,
.upload-container,
.drop-zone {
flex-direction: column;
}
#main-container {
background-color: green;
justify-content:space-around;
width: 100%;
margin: auto;
}
.image-vector {
width: 50vw;
height: 50vh;
flex-shrink: 1;
background: url(https://picsum.photos/200) no-repeat center;
background-size: contain;
}
.upload-container {
background: #17191c;
border-radius: 25px;
flex-shrink: 1;
}
I just added the following code in Responsive Mode. With flex-flow: row wrap; I changed the flex-direction to row and flex-warp to warp break in overflow mode.
#main-container,
.upload-container,
.drop-zone {
flex-flow: row wrap;
}
:root {
--main-bg-color: #212429;
--light-blue: #3a9aed;
--border-color: #3a9aed;
--container-width: 500px;
}
* {
margin: 0px;
padding: 0px;
}
body {
font-family: system-ui;
background: var(--main-bg-color);
height: 98vh;
overflow: hidden;
color: white;
}
body,
#main-container,
.upload-container,
.drop-zone {
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
body,
.upload-container,
.drop-zone {
flex-direction: column;
}
.header-container {
position: absolute;
top: 4%;
font-family: Cambria, Cochin, Georgia, Times, "Times New Roman", serif;
font-size: 55px;
}
#main-container {
background-color: green;
/* justify-content:space-around; */
width: 100%;
margin: auto;
}
.footer-container {
position: absolute;
top: 2%;
left: 80%;
}
.image-vector {
width: 50vw;
height: 50vh;
flex-shrink: 1;
background: url(https://picsum.photos/200) no-repeat center;
background-size: contain;
}
.upload-container {
background: #17191c;
border-radius: 25px;
flex-shrink: 1;
}
.drop-zone {
width: var(--container-width);
min-height: 200px;
border: 2px dashed var(--border-color);
border-radius: 10px;
margin: 30px;
transition: 0.2s all ease-in;
}
/* will be added when user drags */
.drop-zone.dragged {
background: var(--main-bg-color);
border-color: #0288d1;
}
.drop-zone input {
display: none;
}
.icon-container {
position: relative;
width: 75px;
height: 100px;
}
.icon-container img {
width: 75px;
position: absolute;
transition: transform 0.25s ease-in-out;
transform-origin: bottom;
}
.icon-container .center {
z-index: 10;
}
.icon-container .right,
.icon-container .left {
filter: grayscale(0.5);
transform: scale(0.9);
}
.dragged .center {
transform: translateY(-5px);
}
.dragged .right {
transform: rotate(10deg) scale(0.9) translateX(20px);
}
.dragged .left {
transform: rotate(-10deg) scale(0.9) translateX(-20px);
}
.title {
font-size: large;
}
#browseBtn {
color: #2196f3;
cursor: pointer;
}
/* uploading progress styles */
.progress-container {
border: 2px solid var(--main-bg-color);
width: var(--container-width);
height: 70px;
border-radius: 10px;
margin-bottom: 25px;
position: relative;
display: none;
}
.progress-container .inner-container {
margin: 10px 15px;
z-index: 2;
position: absolute;
width: calc(100% - 30px);
}
.progress-container .percent-container {
font-size: 14px;
margin: 5px;
opacity: 0.7;
}
.progress-container .bg-progress {
position: absolute;
background: var(--main-bg-color);
width: 100%;
height: 100%;
z-index: 1;
transition: transform 250ms linear;
transform: scaleX(0);
transform-origin: left;
}
.progress-container .progress-bar {
width: 100%;
height: 3px;
border-radius: 2px;
background: #03a9f4;
transition: transform 200ms linear;
transform: scaleX(0);
transform-origin: left;
}
/* sharing container style */
.sharing-container {
margin-bottom: 25px;
width: var(--container-width);
border-radius: 10px;
display: none;
}
.sharing-container p {
text-align: center;
}
.sharing-container .expire {
font-size: 16px;
opacity: 0.7;
margin-top: 0;
}
.sharing-container .input-container {
display: flex;
position: relative;
width: 100%;
margin-bottom: 20px;
}
.sharing-container .input-container input {
width: 100%;
border-radius: 3px;
padding: 10px 15px;
font-size: 20px;
border: 2px dashed var(--border-color);
border-radius: 6px;
background: #17191c;
color: #ffffff;
}
.sharing-container img {
height: 22px;
width: 30px;
position: absolute;
right: 7px;
top: 12px;
cursor: pointer;
background: #17191c;
color: #ffffff;
}
.email-container form {
border: 2px solid var(--border-color);
width: 100%;
padding: 15px;
box-sizing: border-box;
border-radius: 10px;
display: flex;
flex-direction: column;
align-items: center;
}
.email-container,
.send-btn-container {
display: flex;
flex-direction: column;
align-items: center;
}
.email-container label {
margin: 5px;
font-size: 18px;
}
.email-container input {
border: none;
border-bottom: 2px solid var(--border-color);
height: 19px;
font-size: 18px;
text-align: center;
}
.email-container input:focus {
outline: none;
}
.email-container .filed {
margin-bottom: 5px;
display: flex;
justify-content: space-between;
width: 400px;
}
.send-btn-container button {
font-size: 18px;
padding: 8px 40px;
margin-top: 15px;
background: #3a9aed;
border: none;
border-radius: 5px;
color: #ffffff;
cursor: pointer;
}
.toast {
position: absolute;
bottom: 10px;
right: 50%;
transform: translate(50%, 60px);
padding: 10px 20px;
background: var(--light-blue);
color: #fff;
border-radius: 5px;
font-size: 18px;
box-shadow: 0px 10px 15px -3px rgba(0, 0, 0, 0.1),
0px 4px 6px -2px rgba(0, 0, 0, 0.05);
transition: transform ease-in-out 0.2s;
}
.image-vector {
background: url("https://picsum.photos/200") no-repeat center;
background-size: contain;
height: 50vh;
width: 50vw;
}
.show.toast {
transform: translate(50%, 0);
}
#media screen and (max-width: 900px) {
:root {
--container-width: 320px;
}
body,
#main-container,
.upload-container,
.drop-zone {
flex-flow: row wrap;
}
.email-container .filed {
flex-direction: column;
}
.email-container .filed {
width: 300px;
}
}
<div class="header-container">EZ Sharing</div>
<main id='main-container'>
<section class="upload-container">
<form action="">
<div class="drop-zone">
<div class="icon-container">
<img src="https://picsum.photos/200" draggable="false" class="center" alt="File Icon" />
<img src="https://picsum.photos/200" draggable="false" class="left" alt="File Icon" />
<img src="https://picsum.photos/200" draggable="false" class="right" alt="File Icon" />
</div>
<input type="file" id="fileInput" />
<div class="title">
Drop your Files here or,
<span id="browseBtn">Browse</span>
</div>
</div>
</form>
<div class="progress-container">
<div class="bg-progress"></div>
<div class="inner-container">
<div class="status">Uploading...</div>
<div class="percent-container">
<span class="percentage" id="progressPercent">0 %</span>
</div>
<div class="progress-bar"></div>
</div>
</div>
<div class="sharing-container">
<p class="expire">Link expires in 24 hrs</p>
<div class="input-container">
<input type="text" id="fileURL" readonly />
<img src="./copy-icon.svg" id="copyURLBtn" alt="copy to clipboard icon" />
</div>
<p class="email-info">Or Send via Email</p>
<div class="email-container">
<form id="emailForm">
<div class="filed">
<label for="fromEmail">Your email</label>
<input type="email" autocomplete="email" required name="from-email" id="fromEmail" />
</div>
<div class="filed">
<label for="toEmail">Receiver's email</label>
<input type="email" required autocomplete="receiver" name="to-email" id="toEmail" />
</div>
<div class="send-btn-container">
<button type="submit">Send</button>
</div>
</form>
</div>
</div>
</section>
<div class="image-vector"></div>
</main>
<div class="toast">Sample message</div>
<div class="footer-container">
<a href="" target="_blank">
<img border="0" alt="Facebook" src="./github-logo.svg" width="50" height="50" />
</a>
<a href="/" target="_blank">
<img border="0" alt="Facebook" src="./linkedin.svg" width="50" height="50" />
</a>
<a href="">
<img border="0" alt="Facebook" src="./facebook.svg" width="50" height="50" />
</a>
</div>

HTML CSS - display: inline-block can't center the container with % width

Creating my website and cant make my container with list of elements centerd if I want my grid responsive and have the display: block or display: inline-block and have a % width
heres a the situation im in. I want the grid with blocks to be responsive and have display: block/ display: inline-block (I have this bcs when u click on the button web scraping a button it will hide one of the blocks and I want it to float: left so one of the blocks doent center when one disperse)
$(document).ready(function(){
$("#web-scraping").click(function(){
if($("#web-s").hasClass("hide")){
$('#web-s').removeClass('hide');
}
else{
$("#web-s").addClass('hide')
}
});
});
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
html{
font-size: 10px;
font-family: sofia_pro;
}
a{
text-decoration: none;
}
.container{
min-height: 65vh;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
#hero{
background-color: #32312F;
position: relative;
z-index: 1;
}
#hero .hero{
max-width: 1500px;
margin: 0 auto;
padding: 0 50px;
justify-content: flex-start;
}
#hero h1{
display: block;
width: fit-content;
font-size: 5rem;
position: relative;
color: transparent;
animation: text_reveal .5s ease forwards;
animation-delay: 1s;
}
#hero h1 span{
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 0;
background-color: #fff;
animation: text_reveal_box 1s ease;
animation-delay: 0.5s;
}
#hero p{
display: block;
width: 40%;
font-size: 2rem;
margin-top: 60px;
position: relative;
color: transparent;
animation: text_reveal .5s ease forwards;
animation-delay: 1s;
}
#hero .button-box{
margin-top: 40px;
height: 35px;
width: 140px;
}
#hero .cta{
display: inline-block;
padding: 8px 20px;
color: #fff;
background-color: transparent;
border: 1px solid #fff;
font-size: 1.5rem;
visibility: hidden;
text-transform: uppercase;
position: relative;
transition: .3s ease background-color;
opacity: 1;
animation: box_reveal .5s ease forwards;
animation-delay: 1s;
}
#hero .cta span{
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 0;
background-color: #fff;
animation: box_reveal_box 1s ease;
animation-delay: .5s;
}
#hero .cta:hover{
box-shadow:0px 0px 0px 1px #fff inset;
}
/*animation*/
#keyframes text_reveal_box{
50%{
width: 100%;
left: 0;
}
100%{
width: 0;
left: 100%;
}
}
#keyframes box_reveal_box{
50%{
width: 100%;
left: 0;
}
100%{
width: 0;
left: 100%;
}
}
#keyframes text_reveal{
100%{
color: #fff;
}
}
#keyframes box_reveal{
100%{
visibility: visible;
}
}
.down-pointer{
align-items: center;
justify-content: center;
display: flex;
position: relative;
z-index: 3;
top: -160px;
}
.down-pointer .left{
width: 20px;
height: 20px;
transition: .5s;
float: left;
box-shadow: -2px 2px;
color: #f6f6f6;
}
.down-pointer .left{
transform: rotate(-45deg);
}
.work-container{
background-color: #f6f6f6;
height: 1000px;
max-width: 1300px;
border-radius: 20px 20px 0px 00px;
margin: 0px 60px;
top: -100px;
padding: 100px;
position: relative;
z-index: 2;
}
.work-category{
align-items: center;
justify-content: center;
display: flex;
}
.work-category button{
text-transform: capitalize;
border: 1px solid #32312F;
padding: 15px 30px;
font-size: 1.5rem;
font-weight: 600;
border-radius: 3px;
color: #32312F;
outline: none;
cursor: pointer;
}
.work-category button:hover{
}
#web-scraping{
margin: auto 100px auto auto;
}
#web-design{
margin: auto 0px auto 0px;
}
#web-animation{
margin: auto auto auto 100px;
}
.work-block-container .hide{
display: none;
}
.work-block-container-flex{
}
.work-block-container{
margin: 0 auto;
display: inline-block;
overflow: hidden;
width: 100%;
}
.work-block{
background-color: black;
float: left;
width: 30%;
height: 180px;
border-radius: 3px;
padding: 20px;
margin: 5px;
}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="js/javascript.js"></script>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/animation.css">
<link rel="stylesheet" href="css/media-screen.css">
<title>The HTML5 Herald</title>
</head>
<body>
<!-- Starting-menu-->
<section id=hero>
<div class="hero">
<div class="hero container">
<div>
<h1>What I can do,<span></span></h1>
<h1>for your Business<span></span></h1>
<p><span>
It is a long established fact that a reader will be distracted by
the readable content of a page when looking at its layout. The point
of using Lorem Ipsum is that it has a more-or-less normal distribution
</span></p>
<div class="button-box">Contact Me<span></span></div>
</div>
</div>
</div>
</section>
<!-- End-->
<!-- my work -->
<section class="work-container">
<a class="down-pointer" href="#"><span class="left"></span></a>
<div class="work-category">
<button id="web-scraping">Web Scraping</button>
<button id="web-design">Web Design</button>
<button id="web-animation">web animation</button>
</div>
<div class="work-block-container">
<div class="work-block" id="web-s"></div>
<div class="work-block" id="web-d"></div>
<div class="work-block" id="web-s"></div>
<div class="work-block" id="web-d"></div>
<div class="work-block" id="web-d"></div>
<div class="work-block" id="web-a"></div>
</div>
</section>
<!-- my work end -->
<!-- about me -->
<div class="container about" id="">
<h1>About</h1>
<div class="about-me-info">
<p></p>
<p></p>
<p></p>
</div>
</div>
<!-- about me end-->
<!-- contact me -->
<!-- contact me end -->
</body>
</html>
I think you use another <div> in your container so your flex or grid display just effect on that div!
try display flex or grid on that div or make your container as your element's parents.
First, the ID for each element must be unique. I think you achieved this))
$(document).ready(function(){
$("#web-scraping").click(function(){
$(".web-d").addClass("hide")
$(".web-a").addClass("hide")
$(".web-s").removeClass("hide")
});
$("#web-design").click(function(){
$(".web-d").removeClass("hide")
$(".web-a").addClass("hide")
$(".web-s").addClass("hide")
});
$("#web-animation").click(function(){
$(".web-d").addClass("hide")
$(".web-a").removeClass("hide")
$(".web-s").addClass("hide")
});
});
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
html{
font-size: 10px;
}
a{
text-decoration: none;
}
.container{
min-height: 65vh;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
#hero{
background-color: #32312F;
position: relative;
z-index: 1;
}
#hero .hero{
max-width: 1500px;
margin: 0 auto;
padding: 0 50px;
justify-content: flex-start;
}
#hero h1{
display: block;
width: fit-content;
font-size: 5rem;
position: relative;
color: transparent;
animation: text_reveal .5s ease forwards;
animation-delay: 1s;
}
#hero h1 span{
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 0;
background-color: #fff;
animation: text_reveal_box 1s ease;
animation-delay: 0.5s;
}
#hero p{
display: block;
width: 40%;
font-size: 2rem;
margin-top: 60px;
position: relative;
color: transparent;
animation: text_reveal .5s ease forwards;
animation-delay: 1s;
}
#hero .button-box{
margin-top: 40px;
height: 35px;
width: 140px;
}
#hero .cta{
display: inline-block;
padding: 8px 20px;
color: #fff;
background-color: transparent;
border: 1px solid #fff;
font-size: 1.5rem;
visibility: hidden;
text-transform: uppercase;
position: relative;
transition: .3s ease background-color;
opacity: 1;
animation: box_reveal .5s ease forwards;
animation-delay: 1s;
}
#hero .cta span{
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 0;
background-color: #fff;
animation: box_reveal_box 1s ease;
animation-delay: .5s;
}
#hero .cta:hover{
box-shadow:0 0 0 1px #fff inset;
}
/*animation*/
#keyframes text_reveal_box{
50%{
width: 100%;
left: 0;
}
100%{
width: 0;
left: 100%;
}
}
#keyframes box_reveal_box{
50%{
width: 100%;
left: 0;
}
100%{
width: 0;
left: 100%;
}
}
#keyframes text_reveal{
100%{
color: #fff;
}
}
#keyframes box_reveal{
100%{
visibility: visible;
}
}
.down-pointer{
align-items: center;
justify-content: center;
display: flex;
position: relative;
z-index: 3;
top: -160px;
}
.down-pointer .left{
width: 20px;
height: 20px;
transition: .5s;
float: left;
box-shadow: -2px 2px;
color: #f6f6f6;
}
.down-pointer .left{
transform: rotate(-45deg);
}
.work-container{
background-color: #f6f6f6;
height: 1000px;
max-width: 1300px;
border-radius: 20px 20px 0px 00px;
margin: 0 60px;
top: -100px;
padding: 100px;
position: relative;
z-index: 2;
}
.work-category{
align-items: center;
justify-content: center;
display: flex;
}
.work-category button{
text-transform: capitalize;
border: 1px solid #32312F;
padding: 15px 30px;
font-size: 1.5rem;
font-weight: 600;
border-radius: 3px;
color: #32312F;
outline: none;
cursor: pointer;
}
.work-category button:hover{
}
#web-scraping{
margin: auto 100px auto auto;
}
#web-design{
margin: auto 0 auto 0;
}
#web-animation{
margin: auto auto auto 100px;
}
.work-block-container-flex{
}
.work-block-container{
margin: 0 auto;
display: inline-block;
overflow: hidden;
width: 100%;
}
.work-block{
float: left;
width: 30%;
height: 180px;
border-radius: 3px;
padding: 20px;
margin: 5px;
transition: 0.7s all;
}
.work-block.web-s{
background-color: green;
}
.work-block.web-d{
background-color: blue;
}
.work-block.web-a{
background-color: red;
}
.work-block.web-s.hide{
width: 0;
height: 0;
visibility: hidden;
padding: 0;
margin: 0;
}
.work-block.web-d.hide{
width: 0;
height: 0;
visibility: hidden;
padding: 0;
margin: 0;
}
.work-block.web-a.hide{
width: 0;
height: 0;
visibility: hidden;
padding: 0;
margin: 0;
}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./style.css">
<title>The HTML5 Herald</title>
</head>
<body>
<!-- Starting-menu-->
<section id=hero>
<div class="hero">
<div class="hero container">
<div>
<h1>What I can do,<span></span></h1>
<h1>for your Business<span></span></h1>
<p><span>
It is a long established fact that a reader will be distracted by
the readable content of a page when looking at its layout. The point
of using Lorem Ipsum is that it has a more-or-less normal distribution
</span></p>
<div class="button-box">Contact Me<span></span></div>
</div>
</div>
</div>
</section>
<!-- End-->
<!-- my work -->
<section class="work-container">
<a class="down-pointer" href="#"><span class="left"></span></a>
<div class="work-category">
<button id="web-scraping">Web Scraping</button>
<button id="web-design">Web Design</button>
<button id="web-animation">web animation</button>
</div>
<div class="work-block-container">
<div class="work-block web-s"></div>
<div class="work-block web-d"></div>
<div class="work-block web-s"></div>
<div class="work-block web-d"></div>
<div class="work-block web-d"></div>
<div class="work-block web-a"></div>
</div>
</section>
<!-- my work end -->
<!-- about me -->
<div class="container about" id="">
<h1>About</h1>
<div class="about-me-info">
<p></p>
<p></p>
<p></p>
</div>
</div>
<!-- about me end-->
<!-- contact me -->
<!-- contact me end -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="./js.js"></script>
</body>
</html>

How to achieve this when I hover an flex item?

I have searched all over stack overflow but I am unable to find any clue and I am struck here. I used flex container and child items in my code to some extent but I couldn't move beyond that. Thing is when we hover a child item, a new child item need to be created as shown in the expected result. Should we need to use pseudo element or any other flex properties to achieve this. Thanks much in advance.
My code:
https://jsfiddle.net/k2qr398u/1/
My result
https://imgur.com/kRHNHuu
Expected result:
https://imgur.com/2B6CkYF
/**CSS**/
body {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: sans-serif;
background-color: #400017;
}
.img-css {
width: 50px;
height: 50px;
}
.main-heading {
display: block;
text-align: center;
color: #fc065d;
margin-bottom: 70px;
}
.img-js {
width: 50px;
height: 50px;
}
.container {
display: flex;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
border: 3px solid #360310;
max-width: 610px;
height: 310px;
text-align: center;
margin: 0 auto;
flex-direction: row;
/* transform: translate(-50%,-50%); */
}
.col {
width: 130px;
height: 100px;
margin: 0 auto;
border: 3px solid #5e0a1f;
padding-top: 44px;
padding-left: 26px;
padding-right: 26px;
color: #fff;
background-color: #010001;
border-radius: 30px;
z-index: 20;
/* position: relative; */
}
.col p {
font-size: 16px;
font-weight: bold;
}
.col-2 p {
position: relative;
top: 55px;
text-align: center;
font-weight: bold;
}
<!--**HTML**-->
<body>
<div class="container">
<div class="col col-1">
<img src="images/css.svg" alt="CSS logo" class="img-css">
<br>
<p>I am</p>
</div>
<div class="col col-2">
<p class="my-name">Sri</p>
</div>
<div class="col col-3">
<img src="images/javascript.svg" alt="JS logo" class="img-js">
<p>Developer
</p>
</div>
</div>
</body>
P.S: Sorry if this question sounds very silly or dumb, I am a beginner trying to learn web dev skillsets.
I have created something similar to your expected result. Please run the code snippet for the result.
UPDATE: To include the hover off transition.
/**CSS**/
body {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: sans-serif;
background-color: #400017;
}
.img-css {
width: 50px;
height: 50px;
}
.main-heading {
display: block;
text-align: center;
color: #fc065d;
margin-bottom: 70px;
}
.img-js {
width: 50px;
height: 50px;
}
.container {
display: flex;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
border: 3px solid #360310;
max-width: 610px;
height: 310px;
text-align: center;
margin: 0 auto;
flex-direction: row;
/* transform: translate(-50%,-50%); */
}
.col {
width: 130px;
height: 100px;
margin: 0 auto;
border: 3px solid #5e0a1f;
padding-top: 44px;
padding-left: 26px;
padding-right: 26px;
color: #fff;
background-color: #010001;
border-radius: 30px;
z-index: 20;
position: relative;
}
.col p {
font-size: 16px;
font-weight: bold;
}
/*
.col-2 p {
position: relative;
top: 55px;
text-align: center;
font-weight: bold;
}
*/
.col-1,
.col-2-1,
.col-2-2,
.col-3 {
position: absolute;
left: 0;
top: 0;
transition: 1s;
}
.wrapper {
position: relative;
}
.wrapper:hover .col-1 {
transition: 1s;
left: -200px;
}
.wrapper:hover .col-2-1 {
transition: 1s;
top: -170px;
}
.wrapper:hover .col-2-2 {
transition: 1s;
top: 170px;
}
.wrapper:hover .col-3 {
transition: 1s;
left: 200px;
}
<!--**HTML**-->
<body>
<div class="container">
<div class="wrapper">
<div class="col"> Underneath</div>
<div class="col col-1">
<img src="images/css.svg" alt="CSS logo" class="img-css">
<br>
<p>I am</p>
</div>
</div>
<div class="wrapper">
<div class="col"> Underneath</div>
<div class="col col-2-1">
<p class="my-name">Sri</p>
</div>
<div class="col col-2-2">
<p class="my-name">Pratham</p>
</div>
</div>
<div class="wrapper">
<div class="col"> Underneath</div>
<div class="col col-3">
<img src="images/javascript.svg" alt="JS logo" class="img-js">
<p>Developer
</p>
</div>
</div>
</div>
</body>
The idea is:
Overlay some content over main content.
On hover reveal it :)
.card {
width: 150px;
height: 80px;
border: 1px solid #999;
background: #ccc;
border-radius: 8px;
position: relative;
margin: 20% auto;
}
.card:hover > .o-top {
top: -80px;
background: #f00;
}
.card:hover > .o-bottom {
bottom: -80px;
}
.o-top {
top: 0;
transition: top 1.5s, background 2s;
}
.o-bottom {
bottom: 0;
transition: bottom 1.5s, background 2s;
}
.card-overlay {
position: absolute;
height: 100%;
width: 100%;
background: #333;
pointer-events: none;
color: #fff;
}
<div class="card">
<div class="card-overlay o-top">TOP OVERLAY</div>
<div class="card-overlay o-bottom">BOTTOM OVERLAY</div>
<H3>INTERNAL CONTENT</H3>
</div>