Seeking a solution to ensure the submit button is always positioned at the bottom of the page. While this can be done using position: absolute, bottom
, there's a requirement to address.
If the content height is less than the wrapping div height, the button should align with the bottom of the window. However, if the content exceeds the div height, then the button should remain at the bottom of the content, not the window.
An example demonstrating the second condition can be viewed on this JSFIDDLE link. Assistance is needed to achieve the first condition.
.container {
height: 400px;
width: 400px;
background: red;
overflow: scroll;
}
ul {
list-style: none;
margin: 0;
padding: 0;
}
li {
height: 100px;
background: blue;
margin-bottom: 10px;
color: white;
}
button {
display: block;
width: 100%;
background: black;
height: 40px;
color: white;
}