Can a circular image be created with text positioned to its right?

Hey there, hope everyone is well. I'm attempting to achieve a layout similar to the one in this image:

https://i.sstatic.net/Y6wa4.png

The text should be positioned on the right side of the image, without a large white space separating them. As you can see, there is a significant gap between the text and the image in the second row.

Below is the code I have been using:

.size_picture {
    max-width:10%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8>
<title>Test</title>

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e2808d8d969196908392a2d6ccd7ccd1"></a>/dist/css/bootstrap.min.css" />
</head>
<body>
<div class="container" >
<div class="row mt-5" style="padding-top: 70px;">
<div class="col-md-2 how-img">
<img src="https://material.angular.io/assets/img/examples/shiba1.jpg" class="rounded-circle img-fluid size_picture" alt=""/>
</div>
<div class="col-md-10 mt-5">
<h4><i>Founder</i></h4>
<p class="text-muted">Hello, my name is Test, and I'm happy to present you my project !</p>
</div>
</div>

<div class="row">
<div class="col-md-10 mt-5">
<h4><i>Associate</i></h4>
<p class="text-muted">Hello, my name is Test, and I'm happy to present you my project !</p>
</div>
<div class="col-md-2 how-img">
<img src="https://material.angular.io/assets/img/examples/shiba1.jpg" class="rounded-circle img-fluid size_picture" alt=""/>
</div>
</div>
</div>
</body>
</html>

Kind regards,

Answer №1

You can achieve the desired alignment using the text-right CSS class in Bootstrap, which applies text-align:right; to the specified element.

For your specific case, the second row elements would benefit from the text-right class. Below is an example for reference.

MDN "text-align" reference

.size_picture {
    max-width:10%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8>
<title>Test</title>

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bedcd1d1cacdcaccdfcefe8a908b908d">[email protected]</a>/dist/css/bootstrap.min.css" />
</head>
<body>
<div class="container" >
    <div class="row mt-5" style="padding-top: 70px;">
    <div class="col-md-2 how-img">
      <img src="https://material.angular.io/assets/img/examples/shiba1.jpg" class="rounded-circle img-fluid size_picture" alt=""/>
    </div>
    <div class="col-md-10 mt-5">
      <h4><i>Founder</i></h4>
      <p class="text-muted">Hello, my name is Test, and I'm happy to present you my project !</p>
    </div>
  </div>

  <div class="row">
    <div class="col-md-10 mt-5 text-right">
      <h4><i>Associate</i></h4>
      <p class="text-muted">Hello, my name is Test, and I'm happy to present you my project !</p>
    </div>
    <div class="col-md-2 how-img">
      <img src="https://material.angular.io/assets/img/examples/shiba1.jpg" class="rounded-circle img-fluid size_picture" alt=""/>
    </div>
  </div>
 </div>
 </body>
 </html>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

I'm having trouble getting the gutter padding to show up in one specific content block on my Bootstrap webpage. How can I troubleshoot and resolve this

Currently, I am delving into the realm of Bootstrap 5 and have recently put together a simplistic webpage using the row/column structure suggested by Bootstrap. However, while my other columns seem to be cooperating and displaying the gutter padding as exp ...

Changes made to the CSS are not being reflected on the live production server hosted on our Bitbucket repository

My WordPress website is hosted on a Linux server and connected to a Bitbucket repository, but I am experiencing an issue where CSS changes are not reflecting on the live site. I have made changes to the HTML code and style sheet, and while the HTML code u ...

Sending Image Data in Base64 Format with Ajax - Dealing with Truncated Data

My current challenge involves sending Base64 image data through ajax to the Server. I've noticed that sometimes all the pictures are successfully sent, but other times only a few make it through. Does anyone have suggestions on how to implement error ...

Angular: verifying the presence of any of the ng-content slots supplied

I have a component template that contains several ng-content elements: <div class="form__general"> <ng-content select="[general]"></ng-content> </div> <div class="form__footer"> <ng-conte ...

Issue with submitting form using Jquery on select action

There seems to be an issue with this jquery code that is supposed to trigger a form submit when a drop down select is changed. It works fine on our test site, but once we move it to the live website, it breaks. Can someone help us troubleshoot and identify ...

I attempted to pull information from the database and display it in my checkboxes. However, I encountered an issue where I am unable to save the selected checkboxes back to the database

This code snippet is written in Blade for a reservation form: <div class="col-lg-6"> <div class="contact-form"> <form id="contact" action="{{url('/reservatio ...

Unexpected JavaScript Bug (with jQuery)

I have an interesting code snippet that captures button clicks and then hides the existing content, revealing the content of the clicked item instead. This code is part of my init.js file along with other functionalities: $(function() { $('#conta ...

Ensuring proper alignment between labels and input

How can I align a label and a range input field on the same line? I have tried using display: inline-block, but it does not seem to work. There doesn't appear to be any conflicting styles, and all sources indicate that this approach should be effect ...

Generating a new division element with a unique identifier and subsequently making adjustments to it

Just starting out with HTML and JS here, so please excuse my lack of experience and not-so-great English. I have an ID on an HTML element that I want to add content to using a function. Additionally, I need to create another element (inside the first one) ...

Most effective method for incorporating external content onto website without using iframes (all websites are owned by me)

Managing a collection of websites is no easy task, especially when they are all powered by WordPress. One common feature among these sites is a simple "name, graphic, and social media links" page located at foo.domain.com/partner. Now, I'm looking to ...

PHP Email Form Data Submission

I've been struggling to get a form set up that will send the information to the admin upon submission, but so far, nothing seems to be working. I double-checked my junk and spam folders, and even made sure that $admin_email = "" is correctly set to th ...

Is it possible to create an image or logo that moves in sync with the user's scrolling

Having trouble articulating this question, but I'm trying to replicate the logo in the top right corner of this website: I want the logo to move along with the user as they scroll down, remaining visible at all times. Any ideas on how to achieve this ...

Having trouble finding errors in Python using Selenium?

I encountered an error while using selenium in conjunction with python: selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/main/article/section/form/div[1]/div[2]/ ...

CSS3 family tree tutorial: Incorporating a wife into the design

I came across a fascinating tutorial about creating a family tree using CSS3 only. However, I'm struggling to understand how to depict a marriage. To explain further: What the code currently accomplishes is this: what i aim to include is this: Alth ...

How can I replace the unsightly "Web page not available" error in WebView on Android with a more visually pleasing alternative?

In my WebView Activity, I sometimes encounter issues with loading properly when the WIFI/DATA connection is poor or disconnected. This could potentially be a common occurrence once my app is in use. I'm curious to know how I can replace the unattracti ...

Why isn't my output being shown on the screen?

Why is the output (refresh value) not being displayed? function myFunction() { $a = document.getElementById("examplehtml").value; document.write("<big><bold>"); document.write($a); document.write("</bold></big>"); $b = ...

When a custom icon is clicked in the vue-select dropdown, the custom method is not activated

In my current project, I am creating a vue-component based on vue-select. Within this component, I have added a custom info Icon. The issue I am facing is that when the user clicks on the Icon, instead of triggering my custom method getInfo, it opens the s ...

Error: jwt_decode function has not been declared

I'm currently working on a project and I've hit a roadblock while trying to fetch profile information for the logged-in account using a token. Despite using the JWT-decoding library, I keep encountering the issue where jwt_decode is not defined. ...

What causes my paragraph textContent to vanish after briefly displaying its value?

As a beginner in JavaScript and HTML, I am taking on the challenge of learning these languages from scratch independently. I have encountered an issue with my code where the word "Hi!" briefly flashes below the "Click Me!" button before disappearing compl ...

Aligning the content in the center of a div with inline display

Hi there, I have a quick question for the experts out there. I'm new to all of this so please bear with me :) I'm attempting to center an inline social sharing div on my website, but it's proving to be quite challenging. The div is nested w ...