-2

I want to place id 1 and id 2 next to eachother and the <b> in both of the divs above the input element.

Something Like this

<div>
  <div id="1 " style = "float:left; clear:both">
    <b style ="color: #444444" >Date</b>
    <input class="duedatetextbox" type="text" placeholder="Enter date"                tabindex="101">                        
  </div>
  <div id="2" style = "float:left; clear:both;padding-left:80px;">
    <b style ="color: #444444" >Time</b>
    <input class="duedatetextbox" type="text" placeholder="Enter time"                tabindex="102">
  </div>  
</div>

Thank you in advance!

Icarus
  • 1,627
  • 7
  • 18
  • 32
vheelique
  • 3
  • 1

3 Answers3

0

Try below

 <div >
    <div id="1 " style = "float:left;">
      <b style ="color: #444444" >Date</b><br>
         <input class="duedatetextbox" type="text" placeholder="Enter date" tabindex="101">                        
   </div>
   <div id="2" style = "float:left;padding-left:80px;">
      <b style ="color: #444444" >Time</b><br>
         <input class="duedatetextbox" type="text" placeholder="Enter time" tabindex="102">
    </div>  
  </div>
vic
  • 134
  • 1
  • 11
0

Have 50% width for both of the div's to make them spread through the width and make the b and input tags to display:block to make them one by one.

div.ids {
  width: 50%;
}

div.ids b {
  display: block;
  padding: 10px;
}

div.ids input {
  display: block;
  padding: 10px;
  background: whitesmoke;
  border: solid 1px grey;
  border-radius: 3px;
}
<div>
  <div class="ids" id="1" style="float:left; clear:both">
    <b style="color: #444444">Date</b>
    <input class="duedatetextbox" type="text" placeholder="Enter date" tabindex="101">
  </div>
  <div class="ids" id="2" style="float:left;">
    <b style="color: #444444">Time</b>
    <input class="duedatetextbox" type="text" placeholder="Enter time" tabindex="102">
  </div>
</div>
jafarbtech
  • 6,842
  • 1
  • 36
  • 55
0

Add display:flex and width to main div

<div style="width:400px; display: inline-flex;">
  <div id="1 " style = "float:left; clear:both; width:50%;">
    <b style ="color: #444444" >Date</b>
    <input class="duedatetextbox" type="text" placeholder="Enter date"                tabindex="101">                        
</div>
<div id="2" style = "float:left; clear:both;padding-left:10px; width:50%;">
  <b style ="color: #444444" >Time</b>
  <input class="duedatetextbox" type="text" placeholder="Enter time"                tabindex="102">
</div>  
</div>
vaishali kapadia
  • 934
  • 11
  • 22