What is the best way to stack several items vertically beside an image?

As a beginner in the world of web development, I recently embarked on my first project.

However, I am facing an issue where I cannot align multiple elements under each other next to an image. One element floats at the top beside the image, while the other ends up floating at the bottom. My intention is to have them both aligned under one another.

Here is the code snippet:

HTML:

<div class="container">
  <div class="Main-Heading text-center ">
    <h1>Albert Einstein 1879-1955</h1>
  </div>

  <div class="picture">
    <img class="img-rounded img-thumbnail img-responsive" src="http://science-all.com/images/albert-einstein/albert-einstein-04.jpg" name="Albert Einstein" alt="Albert Einstein posing for a picture with his hands crossed">
    <blockquote cite="http://www.brainyquote.com/quotes/authors/a/albert_einstein.html">
      The important thing is not to stop questioning. Curiosity has its own reason for existing.
    </blockquote>
    <p>Albert Einstein was a German-born theoretical physicist.</p>

  </div>

</div>

This is what I have:

CSS:

.Main-Heading h1 {
   display: inline-block;
   color: black;
   font-size: 70px;
   font-family: Candal;
}
.picture p {
  float: right;
  display: inline-block;
}
.picture blockquote {
  float: right;
  font-family: Pacifico, sans-serif;
  font-size: 17px;
}
.container {
  background-color: rgb(230, 230, 230);
}
.main_text {

}
.picture {
  display: inline-block;
}
body {

}

Answer №1

Align your image to the left.

Include the following code in your CSS:

.picture img {
   float: left;
}

Remember to clear afterwards by adding

<div style="clear: both;"></div>
after your floated elements.

Check out this previously asked question for additional insights as well.

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

Conceal HTML components on certain devices

I am interested in customizing the display of HTML elements on different devices to enhance the overall design for specific viewing experiences. For example, I want to optimize the layout when accessing the page on an iPad as opposed to a PC. In order to ...

Retrieving ng-repeat object in Angular

How can I retrieve the current object from an ng-repeat on ng-click without using $index? The $index method is giving me the wrong index due to my use of orderBy. Ideally, I would like to be able to click on the object (thumbnail) and have $scope.activePer ...

In search of a CSS selector that can target elements based on specific text contained within them

Query: <div class="btn btn-second-in-pair-not-desired btn-tall">Clear search</div> <div class="btn btn-second-in-pair-not-desired btn-tall">Raw Search</div> <div class="btn btn-second-in-pair-not-desired btn-tall">Basic Searc ...

Is there a potential bug when using .fadeOut() within a hidden element?

After examining the code provided: <div class='hotel_photo_select'> Hello </div> <div class='itsHidden' style='display:none'> <div class='hotel_photo_select'> Hello </ ...

Show one line of text at a time with a pause in between each one

On my HTML page, I am looking to showcase text lines in succession with a delay. The unique condition is that when the second line appears, the color of the first line should change. Then, as the third line emerges, the color of the second line should also ...

Issues with CSS Min-Height in Various Web Browsers

Lately, I've been working on a website and trying to create a border that surrounds all my content and extends the full length of the page. The #Container div is supposed to expand to fill the entire page. I've tried using min-height:100%; in my ...

Is there a way to move the submit form button to the next line using CSS?

I am having trouble centering the submit button below two input fields in a simple React form. Can anyone offer assistance with this? HTML .SearchBar-fields { display: flex; justify-content: center; margin-bottom: 2.88rem; flex-direction: row; ...

The JavaScript code will automatically execute loops

Let me illustrate my point with two functions. Function 1 This function triggers a transition when you hover over the square. If you move your mouse off the element and then back on while the transition is still in progress, it will wait until the end of ...

Ways to access the entire parent element, rather than just the individual child element, following the use of e.target

Looking to target the li element itself when clicked, rather than its child elements. The goal is to determine which specific option the user selects from a dropdown menu using event.target in jQuery. If the user chooses an li with a class of 1, set one gl ...

Problem with CSS dotted borders appearing as dashed in Chrome when applied to adjacent columns in a table

After testing the code on both Chrome and Firefox browsers, I noticed that they display the border differently. In Chrome, there is a dash in between adjacent cells while in Firefox, there are no dashes rendering. Can anyone suggest a solution to fix thi ...

Adding a pathway to a clip path: a step-by-step guide

While attempting to create a wave effect on an image, I hit a roadblock. There are two SVGs involved - one with the path I want to use and the other behaving as expected but with the wrong clip path/shape. However, when I try to insert the desired path, ...

Problem with HTML relative paths when linking script sources

Having trouble with a website I constructed using Angular. The problem lies in the references to javascript files in index.html. The issue is that the paths in the HTML are relative to the file, but the browser is searching for the files in the root direct ...

Is it possible for me to include additional fields in a vuetify calendar event?

Is there a method to incorporate additional fields, such as a description, in addition to the name and start/end time for an event on the v-calendar's day view? ...

jquery slider for inputting phone number on a mobile device

I am currently working on enhancing the user interface by implementing a feature where users can select a mobile number using a slider. The idea is that the user will choose a digit between 0 and 9 using the slider, then confirm their selection by pressing ...

Slideshow through each item using Typescript and Angular8

I came across a solution in this carousel on by one link, but I'm struggling to work with the jQuery code even though I have JQuery installed in my project. For example: const next = jQuery(this).next(); I am looking to convert the JQuery code from ...

Guide to creating an HTML table with bokeh

As a newcomer to Bokeh, I've been searching through the documentation for examples but haven't come across an in-built method for creating tables. I have some data that I need to display in tabular format and was wondering what the most straightf ...

How can I achieve a stylish alternating bottom-border effect for my website navigation menu?

Is there a way for me to achieve this navigation style? Here is the code I am working with currently. https://gist.github.com/anonymous/9c239f1b541aa26d461b I'm facing difficulty replicating the line style. Any suggestions on how to accomplish that? ...

Extract the directory name from a URL using PHP, excluding any file names or extensions

Can anyone guide me on extracting the folder name only from a URL in PHP? For example, if my URL is I'm interested in retrieving just the part of the URL. Any suggestions on how to achieve this would be much appreciated. Thanks! ...

Is the second parameter of the function being used as a condition?

Why is it necessary to validate the helpText argument within the function to be non-equative to null when its ID is linked with the span tag? The functions task is to set and clear help messages in the form field using built-in CSS classes. <input id ...

Struggling to create a mobile-friendly design

I've successfully created a dynamic world map using D3.js, but I need some guidance on making it responsive across various screen sizes. You can view the interactive world map here. Credentials to access the map: Username: DXLdemo Password: ...