skip to Main Content

I am a newbie of html and css whereas tyring to practice a couple of things of formulating but my efforts getting into futile.

Please find the code below, and images for your kind reference to get to know your opinion.

.container {
  display: block;
  width: 200px;
  height: 120px;
}

.picture {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-block;
}

.oliver {
  display: inline-block;
  margin-left: 0px;
  font-weight: bold;
  height: 20px;
  text-align: center;
  margin-top: 0px;
  margin-bottom: 0px;
  margin-left: 0px;
  margin-right: 0px;
  vertical-align: top;
  width: 50px;
}

.popular {
  font-size: 15px;
  width: 50px;
  height: 50px;
  color: #666;
  display: inline-block;
  padding-left: 0px;
  padding-right: 0px;
  padding-bottom: 0px;
  padding-top: 0px;
  margin-right: 0px;
  margin-bottom: 0px;
  margin-left: 0px;
  margin-top: 0px;
  vertical-align: center;
}

.follow-button {
  display: inline-block;
  width: 90px;
  height: 30px;
  margin-top: 0px;
  padding: 0px;
  border: 1px solid #ccc;
  border-radius: 9px;
  background-color: #0f6fb0;
  cursor: pointer;
  margin-left: 0px;
  margin-top: 0px;
  margin-bottom: 0px;
  color: white;
  font: verdana;
}

.follow-div {
  display: inline-block;
  width: 20px;
  margin-left: 0px;
  margin-top: 8px;
  margin-bottom: 0px;
  padding: 0px;
  vertical-align: top;
}
<div class="container">
  <img class="picture" src="/Users/riyazmohamed/Desktop/HTML-CSS/Intro-to-html/channel-picture/cat.jpeg" alt="cat" />
  <p class="oliver">oliver</p>

  <p class="popular">the popular cat</p>
</div>
<div class="follow-div">
  <button class="follow-button">Follow</button>
</div>

current output

I want the content of "the papular of cat" to be under Oliver like under picture.

desired output

Please help me, thank you.

content need to be formulated under the olive, please help me to get it done per lateral picture given as sample.

2

Answers


  1. Here is one of the possible solutions using Flexbox. Just wrap the image in one div, p tags are already block-level elements but I have wrapped them also in divs. After that use the display: flex on the .container and that’s it.

    Here is the link Codepen

    <div class="container">
      <div>
      <img class="picture" src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAoHCBYVF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JZxV9psmgWFxyuc1pAykRIJA5WgevBTGygPDykWj1FlDt2TiMViDRpvpt8Muc4uzHMDYAADWCb8Os2u2yt1ywf1nB3/iXCbRBNjEWss/49Xi38kiv/APSfZxpis8kuzuMHoCYA4Rx7krpK1cDgKdFoZTaGtHC5+q2l1Ylk9ufV7X1ERXVEREBERAREQf/Z" alt="cat" />
      </div>
    <div>
      <p class="oliver">oliver</p>
      </div>
      <div>
      <p class="popular">the popular cat</p>
      </div>
      </div>
    </div>
    <div class="follow-div">
      <button class="follow-button">Follow</button>
    </div>
    
    .container {
      display: flex;
      width: 500px;
      height: auto;
      margin-bottom:10px;
    }
    
    .picture {
      width: 100px;
      height: auto;
      border-radius: 50%;
      display: inline-block;
    }
    
    .oliver {
      display: inline-block;
      margin-left: 0px;
      font-weight: bold;
      height: 20px;
      text-align: center;
      margin-top: 0px;
      margin-bottom: 0px;
      margin-left: 0px;
      margin-right: 0px;
      vertical-align: top;
      width: 50px;
    }
    
    .popular {
      font-size: 15px;
      width: 50px;
      height: 50px;
      color: #666;
      display: inline-block;
      padding-left: 0px;
      padding-right: 0px;
      padding-bottom: 0px;
      padding-top: 0px;
      margin-right: 0px;
      margin-bottom: 0px;
      margin-left: 0px;
      margin-top: 0px;
      vertical-align: center;
    }
    
    .follow-button {
      display: inline-block;
      width: 90px;
      height: 30px;
      margin-top: 0px;
      padding: 0px;
      border: 1px solid #ccc;
      border-radius: 9px;
      background-color: #0f6fb0;
      cursor: pointer;
      margin-left: 0px;
      margin-top: 0px;
      margin-bottom: 0px;
      color: white;
      font: verdana;
    }
    
    .follow-div {
      display: inline-block;
      width: 20px;
      margin-left: 0px;
      margin-top: 8px;
      margin-bottom: 0px;
      padding: 0px;
      vertical-align: top;
    }
    
    Login or Signup to reply.
  2. https://codebeautify.org/htmlviewer/y23360db5

        <!DOCTYPE html>
        <html>
        <head>
        <style>
            .container {
                display: flex;
                align-items: center;
            }
    
            .image {
                width: 100px; /* Adjust the width as needed */
                height: auto;
                margin-right: 10px; /* Add spacing between the image and text */
            }
    
            .text {
                font-weight: bold;
            }
        </style>
    </head>
    <body>
        <div class="container">
            <img src="https://clipart.info/images/ccovers/1522855947cartoon-cat-png-clip-art.png" alt="Oliver the cat" class="image">
            <div>
                <span class="text">Oliver</span><br>
                The popular cat
            </div>
        </div>
        </body>
        </html>
    

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search