Link to home
Start Free TrialLog in
Avatar of Rohit Bajaj
Rohit BajajFlag for India

asked on

How to position two buttons side by side

HI,
I have the following html :
<div id="buttons">
        <button id="submit" disabled>Create Note</button>
        <button id="cancel">Cancel</button>
      </div>

Open in new window


currently the styling on them is  :
#buttons {
    margin-top: 18px;
    overflow: hidden;
}

#buttons :first-child {
    float: right;
}

#buttons :nth-child(2) {
    margin-right: 15px;
    float: right;
    padding: 10px 25px;
}

button  {
    background: rgba(10, 190, 81, 1);
    padding: 10px 25px;
    border: none;
    color: #fff;
    cursor: pointer;
    border-radius: 4px;
    outline: none;
}

Open in new window


And they appear like :
User generated imageThe above is on chrome window
But for rendering them in a mobile i want the buttons to appear like :
User generated image
I was able to place them in the middle by overriding the the following rules (using the below ones):
#buttons :first-child {
    float: none;
}
#buttons :nth-child(2) {
    float: none
}
#buttons {
    text-align: center;
}

Open in new window


But as you see in the mobile screen shot.... The buttons will be having a fixed pixels distance on left and right side in the screen shot it is 35px and then the buttons are placed with note button 1.5 times larger than the cancel button

How do i make them look like the mobile ones ?
So basically i have to keep fixed 35 px off the left and right side and the rest of the space gets filled with buttons one 1.5 times larger than the other....

Thanks
ASKER CERTIFIED SOLUTION
Avatar of dgrafx
dgrafx
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial