I am trying to make a simple row of buttons that, when hovered, drops down stylistically.
Here is my HTML:
.yellow {
background-color: #fff444;
}
.blue {
background-color: #7d7dff;
}
.bordered {
border-radius: 5px;
border: 2px solid #000;
}
.bordered-bottom {
border-bottom: 2px solid #000;
}
.round-button {
color: #000;
cursor: pointer;
display: inline-block;
box-shadow: 3px 3px #000;
transition: box-shadow 0.2s, transform 0.2s;
margin: 0 3px 3px 0;
}
.round-button:hover {
background-color: #fff;
transition: box-shadow 0.2s, transform 0.2s;
}
.round-button:active {
transform: translate(2px, 2px);
background-color: #fff;
box-shadow: 1px 1px #000;
transition: box-shadow 0.2s, transform 0.2s;
}
.pad {
padding: 10px;
}
body {
margin: 0px;
}
h1 {
color: black;
font-weight: bold;
margin: 0px;
}
.button-row {
height: 100%;
}
.button-row button {
border: 2px solid #000;
border-left: none;
border-top: none;
height: 100%;
margin-bottom: -2px;
margin-right: 0px;
margin-left: 0px;
transition: padding-top 0.2s, transform 0.2s, margin-top 0.2s;
}
.button-row button+button {
border-left: 2px solid #000;
margin-left: -2px;
}
.button-row button:hover {
background-color: #fff;
display: inline-block;
padding-top: 10px;
margin-top: -10px;
transform: translate(0px, 10px);
transition: padding-top 0.2s, transform 0.2s, margin-top 0.2s;
}
<div id="head" class="yellow">
<h1 class="pad">header</h1>
<div class="button-row bordered-bottom">
<button id="button" class="yellow">Home</button>
<button id="button2" class="yellow">About</button>
</div>
</div>
I expect the result to be as in fig 1:
But it appears as in fig 2:
fig 2
fig 1 is the result I get when making the buttons defined inline in the html like so:
<button id="button" class="yellow">Home</button><button id="button2" class="yellow">About</button>
fig 2 has the same result as putting a space between these two inline buttons:
<button id="button" class="yellow">Home</button> <button id="button2" class="yellow">About</button>
I believed that both ways of writing it (not the one with the space) would appear the same. But it isn't appearing the same. Is there some reason for this? I checked my whitespace--I can remove the tabs, but not the newline.