So, the question is listed in the title. I have a red object that changes its width on-hover. But when it does it, you could see that it goes outside of the central div that is the whole rectangle of the to-do-list app. I am trying to fix this. Video of what is going on: https://youtu.be/ELkusRU7Wr4
Code: deleteTask - the red span that contains the rubbish bin icon listItems - the list items themselves separately (every 'li')
HTML:
<div id="workingField">
<h1 id="toDoListHeader">TO-DO LIST<i class="fa fa-pencil" aria-hidden="true" id="hideInputField"></i></h1>
<input type="text" id="addNewTask" placeholder="Add New Task">
<ul id="tasks">
<li id="listItem">Task1<span id="deleteTask"><i class="fa fa-trash" aria-hidden="true"></i></span></li>
<li id="listItem">Task2<span id="deleteTask"><i class="fa fa-trash" aria-hidden="true"></i></span></li>
<li id="listItem">Task3<span id="deleteTask"><i class="fa fa-trash" aria-hidden="true"></i></span></li>
</ul>
</div>
CSS:
#deleteTask
{
background-color: #f26363;
box-sizing: initial;
clear: left;
color: white;
cursor: pointer;
float: right;
display: inline-block;
height: 100%;
margin: -3px -15px 0px -3px;
opacity: 0;
padding: 3px 0px 0px 2px;
text-align: left;
vertical-align: 0px;
width: 0px;
}
#listItem
{
background-color: white;
color: #595959;
height: 30px;
line-height: 25px;
padding: 3px 15px 0px 15px;
vertical-align: 5px;
}
#listItem:hover #deleteTask
{
opacity: 1;
text-align: center;
-webkit-transition: 2s linear;
-moz-transition: 2s linear;
-o-transition: 2s linear;
transition: 2s linear;
width: 35px;
}