dimanche 20 juin 2021

Alignment Issue in html/css

I have the following code:

@import url('https://fonts.googleapis.com/css?family=Merriweather|Open+Sans');
.blogmaster {
    display: flex;

}

.blogmaster div {
    width: 100%;
}

@media all and (max-width: 500px) {
    .blogmaster {
        flex-flow: wrap;
    }
}

.container1 {
    display: flex;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
}

.square:hover {
    -webkit-transform: translate(20px, -10px);
    -ms-transform: translate(10px, -10px);
    transform: translate(10px, -10px);
    -webkit-box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
}

.square {
    width: 460px;
    height: 430px;
    background: white;
    border-radius: 4px;
    box-shadow: 0px 5px 20px #D9DBDF;
    -webkit-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

.mask {
    clip: rect(0px, 460px, 220px, 0px);
    border-radius: 4px;
    position: absolute;
}

img1 {
    width: 560px;
}

.h11 {
    margin: auto;
    text-align: left;
    margin-top: 240px;
    padding-left: 30px;
    padding-right: 30px;
    font-family: 'Merriweather', serif;
    font-size: 24px;
}

p9 {
    text-align: justify;
    font-family: 'Open Sans', sans-serif;
    font-size: 12px;
    color: #C8C8C8;
    line-height: 18px;
    padding-left: 30px;
    padding-right: 30px;
    display: block;
}

.button56 {
    background-color: #3EDD84;
    color: white;
    width: 100px;
    padding: 10px 18px;
    border-radius: 3px;
    text-align: center;
    text-decoration: none;
    display: block;
    margin-top: 15px;
    margin-left: 30px;
    margin-right: 70px;
    font-size: 12px;
    cursor: pointer;
    font-family: 'merriweather';
}

.parent-div {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
}
@media screen and (max-width: 480px) {
.parent-div {
    flex-direction: column;
}
<div class="section-title">
          <h2>Featured Blogs Of The Day</h2>
          </div>
<div class="parent-div">
            <div class="child-div">
          <div class="blogmaster">
    <div class="column1">
      <div class="row1">
    <div class="container1">
      <div class="square">
        <img src="https://images.unsplash.com/photo-1504610926078-a1611febcad3?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=e1c8fe0c9197d66232511525bfd1cc82&auto=format&fit=crop&w=1100&q=80" class="mask" style="border: 5px solid #555">
     <div class="h11">“Chances Of My Uni/College Admission?”</div>
        <p9>It is that time of the year again (yay!🙂) where we — high school students — are supposed to fill out the applications and land in our dream Universities/Colleges!</p9>
        
     <div><a href="https://m-hussainomer03.medium.com/chances-of-my-uni-college-admission-20bc0efec0af" target="_" class="button56">Read More</a></div>
      </div>
      </div>
      </div>
      </div>
            </div>
            </div>
      <!-- new start of blog -->
          <div class="parent-div">
                    <div class="child-div">
      <div class="blogmaster">
    <div class="column1">
      <div class="row1">
    <div class="container1">
      <div class="square">
        <img src="https://www.isfasports.gr/image/cache/data/products/pr_3-1100x1100.jpg" class="mask" style="border: 5px solid #555">
     <div class="h11">My Career Advice To You: Take These Steps...</div>
        <p9>Humans tend to make mistakes — and its completely normal as it results in the growth and development of an individual — either psychologically or physically.</p9>
        
     <div><a href="https://m-hussainomer03.medium.com/my-career-advice-to-you-take-these-steps-to-ultimate-prosperity-6c0687ce9c9f" target="_" class="button56">Read More</a></div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>

So I have the above code embedded into my website and the output looks like this on my end:

enter image description here

However,I am looking for this output:

enter image description here

How will I modify the CSS to make it like the expected output? I tried copying the same properties inside the .square class to master class so that I get the same result, but it does not work. Also, the alignment of the grey text under the heading is off, like it should be like the expected output I sent above. Any suggestions?




Aucun commentaire:

Enregistrer un commentaire