0

Ii am trying to move the searchUserDiv to the left to o create the bellow layout. However everything I have tried has failed so far to move the div to the left. How can I achieve this?

Here is my current code and the resulting layout.

.searchResultsList {
  background-color: lightblue;
}

.searchResultsList li {
  list-style: none;
}
.searchResultsList * {
  background-color: grey;
  /* margin: 13px 0 13px 0; */
  margin-top: 10px;
  margin-bottom: 10px;
  /* margin-left: 0px; */
  cursor: pointer;
}

.searchUserDiv {
  display: flex;
  align-items: center;
  /* background-color: #353258;
  border: 1px solid #4152F1; */
  color: white;
  cursor: pointer;
  padding-left: 10px;
  width: 85%;
  border-radius: 32px;
}
.searchUsername {
  display: flex;
  align-items: center;
  font-size: 18px;
  font: Arial;
  font-family: sans-serif;
  margin-top: 0px;
  padding-left: 10px;
}
.searchUserProfImg {
  padding-left: 5px;
  height: 40px;
  width:40px;
}
<ul class="searchResultsList" id="searchResultsList">
          <!-- style="display: none;" -->
          <li class="searchUserDiv">
            <img class="searchUserProfImg" id="searchUserProfImg" src="images/defaultProfImg.png">
            <label class="searchUsername" id="searchUsername">username</label>
          </li>
          <li class="searchUserDiv">
            <img class="searchUserProfImg" id="searchUserProfImg" src="images/defaultProfImg.png">
            <label class="searchUsername" id="searchUsername">username</label>
          </li>
          <li class="searchUserDiv">
            <img class="searchUserProfImg" id="searchUserProfImg" src="images/defaultProfImg.png">
            <label class="searchUsername" id="searchUsername">username</label>
          </li>
        </ul>

Thanks for any suggestions or solutions, I very much appreciate it!

1 Answers1

1

Your ul.searchResultsList has a left padding of 40px set by the browser because it's a list. Set padding-left: 0.

Denis G. Labrecque
  • 1,023
  • 13
  • 29