0

that creates a centered list of buttons. Unfortunately at the top of the page.

<html>
<head>
    <style>
        #test {
            display: table;
            margin: 0 auto;
            bottom: 5em;
        }
        .mybtn .button {
            background-color: orange;
            border: 1px solid green;
            width: 120px;
            color: white;
            font-size: 14px;
            padding: 10px;
            text-align: center;
            text-decoration: none;
            display: block;
        }
    </style>
</head>
<body>
<div id="test">
    <div class="mybtn">
        <button class="button">Result</button>
        <button class="button">Result</button>
        <button class="button">Result</button>
        <button class="button">Result</button>
    </div>
</div>
</body>
</html>

any reason why bottom: 5em does not work ?

as a beginner in css I would appreciate any hint on why I need also to set .mybtn make the css work !

user3732793
  • 1,699
  • 4
  • 24
  • 53

1 Answers1

0

Just place position:relative

<html>
<head>
    <style>
        #test {
            position: relative;
            display: table;
            margin: 0 auto;
            bottom: 5em;
        }
        .mybtn .button {
            background-color: orange;
            border: 1px solid green;
            width: 120px;
            color: white;
            font-size: 14px;
            padding: 10px;
            text-align: center;
            text-decoration: none;
            display: block;
        }
    </style>
</head>
<body>
<div id="test">
    <div class="mybtn">
        <button class="button">Result</button>
        <button class="button">Result</button>
        <button class="button">Result</button>
        <button class="button">Result</button>
    </div>
</div>
</body>
</html>
Sheri
  • 1,383
  • 3
  • 10
  • 26
  • sorry that didn't work. Actually did look even worse as it moved above top. I tried IE, CHrome, Firefox on Windows and MAC – user3732793 Nov 22 '19 at 07:50