skip to Main Content

enter image description here

I am looking to create a similar widget on my page https://kunalaren.com/about-me/
My subscription div is falling out of place. I need to align it in the same way as it is shown in the image.

Width of each div is set to 50% and 1,3 and 2,4 child of .cta are supposed to be float in left and right respectively.

Any help is appreciated.

HTML

<div class="cta">
<div> <p>Double Your Sales Today!</p></div>

<div><p>Use the form below to open his daily email tips and free consultation worth $97.</p></div>

<div><p>Leader of SEO and Digital Marketing is Giving Away Tips For Doubling Sales Right Now!</p></div>
<div>[contact-form-7 id="125" title="Subscribe"]</div>

</div>

CSS

.cta{
    background-color:white;
width:100%;
padding:10px;
}

.cta div:nth-child(1){
width:50%;
float:left;
}
.cta div:nth-child(1) > p{
margin:0px;
padding-left:30px;
padding-bottom:10px;
    display:inline-block;
font-weight:bolder;
font-size:40px;
color:black;
font-family: 'Roboto Condensed', sans-serif;
}

div.cta div:nth-child(2){
    width:50%;
    float:right;
}
div.cta div:nth-child(2)>p{
color:black;
    text-align:center;
font-family: 'Style Script', cursive;
margin:0px;
font-size:40px;
background-color:#ffc569;
    line-height:40px;
    padding:5px;
}
div.cta div:nth-child(3)>p{
    color:black;
    font-size:20px;
    font-weight:bold;

}
div.cta div:nth-child(3){
    width:50%;
    font-family: 'Roboto Condensed',serif;
padding-left:25px;
}

div.cta div:nth-child(4){
float:right;
width:50%;
margin-top:0px;
}
/*******Mob. Responsive***/

@media only screen and (max-width: 900px){
    div.cta div:nth-child(n),div.cta div:nth-child(n)>p{
         float:none;
        width:100%;
        text-align:center;
        padding-left:0px;
    }
}

2

Answers


  1. You can use this

    <div class="cta">
     <div class="half"> 
      <p>Double Your Sales Today!</p>
      <p>Use the form below to open his daily email tips and free 
         consultation worth $97.
      </p>
     </div>
    
     <div class="half">
      <p>Leader of SEO and Digital Marketing is Giving Away Tips For 
      Doubling 
         Sales Right Now!
      </p>
      <div>[contact-form-7 id="125" title="Subscribe"]</div>
     </div>
    
    </div>
    

    CSS:

    .cta {
     display: flex;
     justify-content: space-between;
     align-items: center;
    }
    
    .half {
     flex: 0.5
    }
    
    
    Login or Signup to reply.
  2. I removed some styling, but grid should work ok

    .cta {
      background-color: white;
      width: 100%;
      padding: 10px;
    }
    
    
    .clear {
     clear: both;
    }
    
    .cta-left, .cta-inner-left {
      width: 50%;
      float: left;
    }
    
    .cta-right, .cta-inner-right {
      width: 50%;
      float: right;
    }
    
    .cta-left > p {
      margin: 0px;
      padding-left: 30px;
      padding-bottom: 10px;
      display: inline-block;
      font-weight: bolder;
      font-size: 40px;
      color: black;
      font-family: "Roboto Condensed", sans-serif;
    }
    
    .cta-right > p {
      color: black;
      text-align: center;
      font-family: "Style Script", cursive;
      margin: 0px;
      font-size: 40px;
      background-color: #ffc569;
      line-height: 40px;
      padding: 5px;
    }
    
    /*******Mob. Responsive***/
    
    @media only screen and (max-width: 900px) {
      .cta-left,
      .cta-right {
        float: none;
        width: 100%;
        text-align: center;
        padding-left: 0px;
      }
    }
    <div class="cta">
      <div class="cta-left">
        <p>Double Your Sales Today!</p>
        <div class="cta-inner">
          <div class="cta-inner-left">
    
              Leader of SEO and Digital Marketing is Giving Away Tips For Doubling
              Sales Right Now!
    
          </div>
          <div class="cta-inner-right">[contact-form-7 id="125" title="Subscribe"]</div>
           <div class="clear"></div>
       </div>
      </div>
      <div class="cta-right">
        <p>
          Use the form below to open his daily email tips and free consultation
          worth $97.
        </p>
      </div>
    </div>
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search