Cpt Kitkat
Cpt Kitkat

Reputation: 1402

How do I give spacing/padding between my divs

I have 3 input box and I want to give padding between them. I can't understand where to put padding. Link to codepen

I have 3 Input boxes.

@import url(https://fonts.googleapis.com/css?family=Montserrat);
body {
  display: inline-block;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  font-family: Montserrat;
  background: #313E50;
}

.text-input {
  position: relative;
  margin-top: 50px;
  display: inline-block;
}

.text-input input[type="text"] {
  display: inline-block;
  width: 300px;
  height: 40px;
  box-sizing: border-box;
  outline: none;
  border: 1px solid lightgray;
  border-radius: 3px;
  padding: 10px 10px 10px 100px;
  transition: all 0.1s ease-out;
}

.text-input input[type="text"]+label {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  height: 40px;
  line-height: 40px;
  color: white;
  border-radius: 3px 0 0 3px;
  padding: 0 20px;
  background: #E03616;
  -webkit-transform: translateZ(0) translateX(0);
  transform: translateZ(0) translateX(0);
  transition: all 0.3s ease-in;
  transition-delay: 0.2s;
}

.text-input input[type="text"]:focus+label {
  -webkit-transform: translateY(-120%) translateX(0%);
  transform: translateY(-120%) translateX(0%);
  border-radius: 3px;
  transition: all 0.1s ease-out;
}

.text-input input[type="text"]:focus {
  padding: 10px;
  transition: all 0.3s ease-out;
  transition-delay: 0.2s;
}
<div class="text-input">
  <input type="text" id="input1" placeholder="Try typing something in here!">
  <label for="input1">Name</label>
</div>
<div class="text-input">
  <input type="text" id="input1" placeholder="Try typing something in here!">
  <label for="input1">Name</label>
</div>
<div class="text-input">
  <input type="text" id="input1" placeholder="Try typing something in here!">
  <label for="input1">Name</label>
</div>

Upvotes: 0

Views: 67

Answers (2)

AddWeb Solution Pvt Ltd
AddWeb Solution Pvt Ltd

Reputation: 21681

please try this css :

.text-input {
  margin-left: 10px;
 margin-right: 10px;
}

Upvotes: 1

Lalji Tadhani
Lalji Tadhani

Reputation: 14159

Add margin-right on .text-input

.text-input{
  position: relative;
  margin-top: 50px;
  display: inline-block;
  margin-right: 50px;/*Add This*/

https://codepen.io/anon/pen/GLzJvM

Upvotes: 4

Related Questions