skip to Main Content

Hi I’ve designed the user profile page. Here, in my page the “upload photo” text & the “My Response Rate” text are in one over the other. I tried clear the float & i tried some other method but i couldn’t fix the issue. still the issue is there. Please help me to fix this. Thanks in advance.

.dashboard-profile-wrp {
  margin: 25px 0px;
  border: 1px solid #b8c0c5;
  padding: 1.429rem;
  border-radius: 1px;
}

.dashboard-profile-wrp h3 {
  margin-top: 0px;
  margin-bottom: 25px;
  border-bottom: 1px solid #b8c0c5;
}

.dashboard-profile-img {
  height: 7.143rem;
  width: 7.143rem;
  float: left;
}

.dashboard-profile-img-content {
  margin: auto;
  margin-left: 1.429rem;
  display: inline-block;
}

.dashboard-profile-img img {
  max-height: 100%;
  max-width: 100%;
  border-radius: 50%;
}

.dashboard-response {
  clear: both;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://cdn.paperindex.com/js/avatars.js"></script>
<div class="container-fluid">
  <div class="row">
    <div class="col-sm-4">
      <div class="dashboard-profile-wrp">
        <h3>Your Profile</h3>
        <div class="dashboard-profile-img">
          <img avatar="Prabu Perumal" width="120" height="120">
          <p><a href="#" class="link">Upload Photo</a></p>
        </div>
        <div class="dashboard-profile-img-content">
          <p>Prabu Perumal</p>
          <p>Basic Member</p>
          <p><a href="#" class="link">Upgrade</a></p>
        </div>
        <div class="dashboard-response">
          <p>My Response Rate</p>
          <p>40%</p>
          <p>My Avg. response Time</p>
          <p>2 hours%</p>
          <p><b>Contact Info</b> - <a href="#" class="link">Update</a></p>
        </div>
      </div>
    </div>
    <div class="col-sm-8">
    </div>
  </div>
</div>

4

Answers


  1. remove the height from .dashboard-profile-img
    Then remove the width on the <img> element

    .dashboard-profile-wrp {
      margin: 25px 0px;
      border: 1px solid #b8c0c5;
      padding: 1.429rem;
      border-radius: 1px;
    }
    
    .dashboard-profile-wrp h3 {
      margin-top: 0px;
      margin-bottom: 25px;
      border-bottom: 1px solid #b8c0c5;
    }
    
    .dashboard-profile-img {
      width: 7.143rem;
      float: left;
    }
    
    .dashboard-profile-img-content {
      margin: auto;
      margin-left: 1.429rem;
      display: inline-block;
    }
    
    .dashboard-profile-img img {
      max-height: 100%;
      max-width: 100%;
      border-radius: 50%;
    }
    
    .dashboard-response {
      clear: both;
    }
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <script src="https://cdn.paperindex.com/js/avatars.js"></script>
    <div class="container-fluid">
      <div class="row">
        <div class="col-sm-4">
          <div class="dashboard-profile-wrp">
            <h3>Your Profile</h3>
            <div class="dashboard-profile-img">
              <img avatar="Prabu Perumal" width="120">
              <p><a href="#" class="link">Upload Photo</a></p>
            </div>
            <div class="dashboard-profile-img-content">
              <p>Prabu Perumal</p>
              <p>Basic Member</p>
              <p><a href="#" class="link">Upgrade</a></p>
            </div>
            <div class="dashboard-response">
              <p>My Response Rate</p>
              <p>40%</p>
              <p>My Avg. response Time</p>
              <p>2 hours%</p>
              <p><b>Contact Info</b> - <a href="#" class="link">Update</a></p>
            </div>
          </div>
        </div>
        <div class="col-sm-8">
        </div>
      </div>
    </div>
    Login or Signup to reply.
  2. in .dashboard-response class, remove the clear: float and introduce the CSS flexbox. Also, have the flex-direction of this class as ‘column’

        .dashboard-profile-wrp {
      margin: 25px 0px;
      border: 1px solid #b8c0c5;
      padding: 1.429rem;
      border-radius: 1px;
    }
    
    .dashboard-profile-wrp h3 {
      margin-top: 0px;
      margin-bottom: 25px;
      border-bottom: 1px solid #b8c0c5;
    }
    
    .dashboard-profile-img {
      height: 7.143rem;
      width: 7.143rem;
      float: left;
    }
    
    .dashboard-profile-img-content {
      margin: auto;
      margin-left: 1.429rem;
      display: inline-block;
    }
    
    .dashboard-profile-img img {
      max-height: 100%;
      max-width: 100%;
      border-radius: 50%;
    }
    
    .dashboard-response {
      margin-top: 30px;
      display: flex;
      flex-direction: column;
    }
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <script src="https://cdn.paperindex.com/js/avatars.js"></script>
        <div class="container-fluid">
      <div class="row">
        <div class="col-sm-4">
          <div class="dashboard-profile-wrp">
            <h3>Your Profile</h3>
            <div class="dashboard-profile-img">
              <img avatar="Prabu Perumal" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAYAAAA5ZDbSAAAFbklEQVR4Xu2dzYsbdRjHvzNhTDeb7ctitAhFKYJSLYroioIH8eILlorF3hQ9eKmgB3vpUQ966D8gCl56K1WpbRV1QdGWFqr20mqVSiuspVZajSaZTSYZmSWBYmcmk3k2mSeP373uPMP3+XzyzEt+k8T5+735EPwzS8ChYLNuVxqjYNt+Kdi4XwqmYOsEjPfHczAFGydgvD1OMAUbJ2C8PU4wBRsnYLw9TjAFGydgvD1OMAUbJ2C8PU4wBRsnYLw9TjAFGydgvD1OMAUbJ2C8PU4wBRsnYLw9TjAFGydgvD1OMAUbJ2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ws7Bq/JUpbR7CpYT1D4h2vNJDXCCEz58puUIQ8FCApxg4wApmIKFBIot5zmY52DZK1D7IVB7Phl9Ix8+k0CgYAm9KXgjgYIpWEig2HJeZPEiS/YK1H4I1J5PRp8XWVxNkr6CKk9/Cvem678jo3f1DJofPCLdvbheez5pg2M/B0sDsl5GgIJl/NRXU7B6RbKAFCzjp76agtUrkgWkYBk/9dUUrF6RLCAFy/ipr6Zg9YpkASlYxk99NQWrVyQLSMEyfuqrKVi9IllACpbxU19NweoVyQJSsIyf+moKVq9IFpCCZfzUV1OwekWygBQs46e+moLVK5IFpGAZP/XVFKxekSwgBcv4qa+mYPWKZAEpWMZPfTUFq1ckC0jBMn7qqylYvSJZQAqW8VNfTcHqFckCUrCMn/pqClavSBaQgmX81FdTsHpFsoAULOOnvpqC1SuSBaRgGT/11RSsXpEsIAXL+Kmv/hclj3u10kc1HgAAAABJRU5ErkJggg==" width="120" height="120">
              <p><a href="#" class="link">Upload Photo</a></p>
            </div>
            <div class="dashboard-profile-img-content">
              <p>Prabu Perumal</p>
              <p>Basic Member</p>
              <p><a href="#" class="link">Upgrade</a></p>
            </div>
            <div class="dashboard-response">
              <p>My Response Rate</p>
              <p>40%</p>
              <p>My Avg. response Time</p>
              <p>2 hours%</p>
              <p><b>Contact Info</b> - <a href="#" class="link">Update</a></p>
            </div>
          </div>
        </div>
        <div class="col-sm-8">
        </div>
      </div>
    </div>
    Login or Signup to reply.
  3. There are many approaches to this problem
    try givving each division ie. div a margin in the top and in the bottom

    for instance:

    <div id=1></div>
    <div id=2></div>
    <div id=3></div>
    <script type=text/css>
    #1{
    margin:5px 5px 5px 5px ;
    }
    #2{
    margin:5px 5px 5px 5px ;
    }
    #3{
    margin:5px 5px 5px 5px ;
    }
    </script>
    
    Login or Signup to reply.
  4. Make the font size of “Upload Photo” content smaller and make it positioned absolute.

    Not the solution that is necessary as it changes the design a bit. The “upload Photo” link looks closer to photo and gives a better sense.

    You can also make it appear just on hover of image.

    .dashboard-profile-wrp {
      margin: 25px 0px;
      border: 1px solid #b8c0c5;
      padding: 1.429rem;
      border-radius: 1px;
    }
    
    .dashboard-profile-wrp h3 {
      margin-top: 0px;
      margin-bottom: 25px;
      border-bottom: 1px solid #b8c0c5;
    }
    
    .dashboard-profile-img {
      height: 7.143rem;
      width: 7.143rem;
      float: left;
      position: relative;
    }
    
    .dashboard-profile-img-content {
      margin: auto;
      margin-left: 1.429rem;
      display: inline-block;
    }
    
    .dashboard-profile-img img {
      max-height: 100%;
      max-width: 100%;
      border-radius: 50%;
    }
    
    .dashboard-profile-img .upload{
        position: absolute;
        top: 70px;
        font-size: 11px;
        left: 3px;
    }
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <script src="https://cdn.paperindex.com/js/avatars.js"></script>
    <div class="container-fluid">
      <div class="row">
        <div class="col-sm-4">
          <div class="dashboard-profile-wrp">
            <h3>Your Profile</h3>
            <div class="dashboard-profile-img">
              <img avatar="Prabu Perumal" width="120" height="120">
              <p class="upload"><a href="#" class="link">Upload Photo</a></p>
            </div>
            <div class="dashboard-profile-img-content">
              <p>Prabu Perumal</p>
              <p>Basic Member</p>
              <p><a href="#" class="link">Upgrade</a></p>
            </div>
            <div class="dashboard-response">
              <p>My Response Rate</p>
              <p>40%</p>
              <p>My Avg. response Time</p>
              <p>2 hours%</p>
              <p><b>Contact Info</b> - <a href="#" class="link">Update</a></p>
            </div>
          </div>
        </div>
        <div class="col-sm-8">
        </div>
      </div>
    </div>
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search