Buttons next to each other


#1

Hi.

I am new at this. Trying to put 2 buttons , next to each other . Using code below, but for some reason they are coming one under the other(in 2 lines).
Any help or advise, please!

Code:

<meta name="buyer">
<html>
<head>
<style>

.btn-group button {
    background-color: #4CAF50; /* Green background */
    border: 1px solid green; /* Green border */
    color: white; /* White text */
    padding: 10px 24px; /* Some padding */
    cursor: pointer; /* Pointer/hand icon */
    float: left; /* Float the buttons side by side */
}

.btn-group button:not(:last-child) {
    border-right: none; /* Prevent double borders */
}

/* Clear floats (clearfix hack) */
.btn-group:after {
    content: "";
    clear: both;
    display:inline-block;
}

/* Add a background color on hover */
.btn-group button:hover {
    background-color: #3e8e41;
}
</style>
</head>

<body>

<div class="btn-group">
  <button>button1</button>
  <button>button2</button>
 </div>

</body>
</html>

#2

There is nothing :after so that approach ends up doing noting.

.btn-group button {
     display: inline-block;
}

#3

Thank you for help.
I tried , still did not work


#4

Which lesson is this (please post a link)?


#5

Not sure which lesson is it. I got it from other source


#6

Then we’re at a disadvantage unless we can see the code run. Can you share it in a sandbox?


#7

I am not sure how to do it. Could you help with that? Where to find sandbox?
And you mentioned lessons. Thanks


#8

If this is a CC exercise, then the lesson environment is the sandbox. If not, then you could try repl.it.

In the event it is an exercise, then please post a link to same. Thanks.


#9

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.