i wanted to move a element up, i tried with margin-top, but it seems it doesnt work.
#nextquestion {
margin-left: 80%;
width: 15%;
background-color: #333333;
height: 40%;
color: white;
font-size: 20px;
border: none;
margin-top: 0.01%;
display: inline-block;
}
#question1 {
color: white;
margin-left: 2.5%;
font-size: 31px;
margin-top: 5%;
}
<div style="background-color: #161624; width: 100%; height: 20%; vertical-align: bottom ; " d>
<a id="question1" style="display: inline-block;">Question 1/X</a>
<button id="nextquestion">Next Question</button>
</div>
I have added display: inline-block, but it didnt change anything.
enter image description here
Margin-top: -…, doesnt change a lot
>Solution :
That’s not the right way to do it in my opinion. Using negative margins is not a good practice. I would instead use flex to achieve it:
#question-container {
background-color: #161624;
display: flex;
flex-direction: row;
height: 20%;
justify-content: space-between;
padding: 3rem;
}
#nextquestion {
width: 15%;
min-width: 120px;
background-color: #333333;
color: white;
font-size: 20px;
border: none;
}
#question1 {
color: white;
font-size: 31px;
}
<div id="question-container">
<a id="question1" style="display: inline-block;">Question 1/X</a>
<button id="nextquestion">Next Question</button>
</div>