Skip to content Skip to sidebar Skip to footer

Is There Any Way To Delete Those Space Between The 2 Column?

Hope you're all well. While I'm sick with this coronavirus, I'm trying to improve my web skills. I'm trying to make a 2 column table with only span/li/ul. Here is my code : You ca

Solution 1:

Remove the fixed width from li and use white-space:nowrap instead then add text-md-end to your first columns to avoid the gap

body {
   background-color: #FEFAF6;
   font-family: 'Segoe UI Regular';
   font-size: 14px;
}

.fa-star {
   color : #154360;
}

.all_star {
   margin-left: 30px;
   white-space:nowrap;
}

li {
   list-style-type: none;
   display:inline-block;
}

li:hover {
   background-color: red;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
  <div class="container">
      <div class="row">
        <div class="col-md-6 text-md-end">
          <ul>
            <li>
              <span class="">1bcdeqgsterudisoqpardbfhert</span>
              <span class="all_star">
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
              </span>
            </li>
          </ul>
        </div>

        <div class="col-md-6">
          <ul>
            <li>
              <span class="">2bcdeqgsterudisoqpardbfhert</span>
              <span class="all_star">
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
              </span>
            </li>
          </ul>
        </div>
      </div>

      <div class="row">
        <div class="col-md-6 text-md-end">
          <ul>
            <li>
              <span class="">3Abcdeqgsterudisoqpardbfher</span>
              <span class="all_star">
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
              </span>
            </li>
          </ul>
        </div>
      

        <div class="col-md-6">
          <ul>
            <li>
              <span class="">4Abcdeqgsterudisoqpardbfher</span>
              <span class="all_star">
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
              </span>
            </li>
          </ul>
        </div>
      </div>

      <div class="row">
        <div class="col-md-6 text-md-end">
          <ul>
            <li>
              <span class="">5Abcdeqgsterudisoqpardbfher</span>
              <span class="all_star">
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
              </span>
            </li>
          </ul>
        </div>



        <div class="col-md-6">
          <ul>
            <li>
              <span class="">6bcdeqgsterudisoqpardbfhert</span>
              <span class="all_star">
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
              </span>
            </li>
          </ul>
        </div>
      </div>
    </div>

Solution 2:

  1. The weird indentation of last row occured because you forgot to close one <div> tag. Use HTML validators to find these kinds of errors: https://validator.w3.org/#validate_by_input You can just copy-paste code and click "Check" button.

  2. To have super responsive control over elements, I would apply nested Grid behavior. Here is an example of single row code:

<div class="row">
    <div class="col-md-6">
        <div class="row">
            <div class="col-md-6">1bcdeqgsterudisoqpardbfhert</div>
            <div class="col-md-6">
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
            </div>
        </div>
    </div>
    <div class="col-md-6">
        <div class="row">
            <span class="col-md-6">2bcdeqgsterudisoqpardbfhert</span>
            <span class="col-md-6">
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
                <span class="fas fa-star"></span>
            </span>
        </div>
    </div>
</div>

EDIT: example of three column solution:

<div class="row">
  <div class="col-md-4">
    <div class="row">
      <div class="col-md-6">1bcdeqgsterudisoqpardbfhert</div>
      <div class="col-md-6">
        <span class="fas fa-star"></span>
        <span class="fas fa-star"></span>
        <span class="fas fa-star"></span>
        <span class="fas fa-star"></span>
        <span class="fas fa-star"></span>
      </div>
    </div>
  </div>
  <div class="col-md-4"></div>
  <div class="col-md-4">
    <div class="row">
      <span class="col-md-6">2bcdeqgsterudisoqpardbfhert</span>
      <span class="col-md-6">
        <span class="fas fa-star"></span>
        <span class="fas fa-star"></span>
        <span class="fas fa-star"></span>
        <span class="fas fa-star"></span>
        <span class="fas fa-star"></span>
      </span>
    </div>
  </div>
</div>

Post a Comment for "Is There Any Way To Delete Those Space Between The 2 Column?"