The Issue at Hand
One problem I am encountering is the default spacing between my edit and delete buttons in the HTML document. When I use JavaScript to append a new list item that mirrors the structure and class names of the existing buttons, the newly added buttons do not exhibit the same spacing. This discrepancy is causing frustration in achieving uniform button layouts.
Preferred Outcome I aim for the appended buttons to seamlessly align with the "default" buttons as they are presented in the HTML markup initially.
Check out the Codepen demonstration.
HTML Markup
<ul id="list">
<li class="item">
<div>Milk</div>
<button class="edit-button">edit</button>
<button class="delete-button">X</button>
</li>
<li class="item">
<div>Cheerios</div>
<button class="edit-button">edit</button>
<button class="delete-button">X</button>
</li>
<li class="item">
<div>Cheese</div>
<button class="edit-button">edit</button>
<button class="delete-button">X</button>
</li>
</ul>
Styling Guidelines
.title {
text-align: center;
}
.main {
border: 1px solid black;
width: 50%;
margin: auto;
}
#add-item {
border: 1px solid black;
}
.input {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
.label {
margin: 10px;
}
#list {
flex-direction: column;
display: flex;
}
#list > li{
list-style-type: none;
margin: 10px auto;
}
#list div {
margin-bottom: 10px;
text-align: center;
}
For more details on the JavaScript functions and specific challenges faced, feel free to explore the Codepen link. Extra efforts to resolve the spacing issue have been documented, yet a satisfactory solution remains elusive. The journey continues in tackling this curious conundrum.