0

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;

}

enter image description here

Whoever wants the code details I will put it

Edit: It worked .. Unlimited thanks to everyone who tried with me .. Thank you

Mohammed
  • 27
  • 4

4 Answers4

0

"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."

  • He partially succeeded ... another problem appeared look at the picture https://ibb.co/v4nzjMk – Mohammed Sep 09 '20 at 21:30
  • Are you setting the container's width - the width of #cv? It looks like it's set to be wider than the viewport. Set it to something like "100%" instead of a pixel value. – Zachary Murrell Sep 09 '20 at 21:37
0

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>
                <a href="#" type="button" class="cta">Enter</a>
            </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>
Johannes
  • 64,305
  • 18
  • 73
  • 130
  • Thank you for this addition .. But another problem arose when I added a fourth element look at the picture https://ibb.co/v4nzjMk – Mohammed Sep 09 '20 at 21:33
0

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>
Emy
  • 639
  • 4
  • 13
0

Change your css rule:

#cv .cv-buttom {
  display: flex;
  margin-top: 50px;
}
snsakib
  • 1,062
  • 9
  • 14