What is the HTML code needed to stack two divs on top of each other?

Many individuals seem to be inquiring about this issue, yet I am still unable to resolve it completely. The image I have linked closely resembles what I am aiming for. I would like the image in each section to flow from left to right, as it currently does, but the second image (on the right) and its corresponding text (below) are not aligning properly with the first 'block'. Additionally, I am also looking to incorporate a third section with an image aligned to the left, but I am uncertain of how to correctly execute this.

View the current site image here

Here is the current HTML code:

    <div id="container">
        <div id="floated-img">
            <img src="image" alt="">
            <p>
                Lorem...
            </p>
        </div>
    </div>
    <div id="container1">
        <div id="floated-img1">
            <img src="image" alt="">
            <p>
                Lorem... 
            </p>
        </div>
    </div>

And this is my CSS code:

#floated-img img {
    display: block;
    width: 200px;
    float: left;
    margin-right: 10px;
    margin-top: -16px;
    margin-left: -16px;
}

#floated-img p {
    margin-top: -7px;
}

#floated-img1 img {
    width: 200px;
    float: right`
    margin-right: -16px;
}

Answer №1

To test The Secure Show, I do not floated, it is taken out of the regular document flow, allowing other content to wrap and its configuration to wrap and its top with an to wrap and allow other content to wrap and it.

You can try it for yourself and see how using other content to wrap and and it is wrapped around it.

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

Styling rounded buttons with GTK and CSS

In my C++ application, I am attempting to create a rounded button by utilizing an external CSS file. Although I have successfully achieved a round button, there is still a pesky rectangular border that remains and I am struggling to figure out how to remo ...

Apply a see-through overlay onto the YouTube player and prevent the use of the right-click function

.wrapper-noaction { position: absolute; margin-top: -558px; width: 100%; height: 100%; border: 1px solid red; } .video-stat { width: 94%; margin: 0 auto; } .player-control { background: rgba(0, 0, 0, 0.8); border: 1px ...

Capture screenshots of the web page URLs within the Chrome browser by utilizing PhantomJS

Looking for a way to capture screenshots of various URLs and display them in the Chrome browser using PhantomJS. How can I achieve this? Any assistance would be greatly appreciated, as nothing is currently showing up on the webpage. This is how my code a ...

Dynamic CSS containers that adjust according to browser and screen dimensions

01) In my attempt to create a row with two content boxes, I encountered an issue. The first box is supposed to display an image and the second box text. However, I am struggling to make it responsive and interactive based on different browser and screen si ...

Is it possible to include padding within a textarea element?

Is it possible to add some left margin inside a textarea? I would like there to be some extra space because I am using an image icon as my button within the textarea, and when I type, the words end up covering the image. <div id="inputBox"> < ...

Blog Writer: Picture quality compromised when adjusting size

Issue with blurry images after resizing. The problem is noticeable in the three main images located under the Header section. To preview the blog, click on this link: Click Here Your assistance in solving this issue would be greatly appreciated. Thank yo ...

Utilize JavaScript to target the specific CSS class

Hello, I am currently using inline JS in my Wordpress navigation menu, redirecting users to a login page when clicked. However, I have been advised to use a regular menu item with a specific class and then target that class with JS instead. Despite searchi ...

"The application is experiencing issues with loading styles correctly when using jQuery append (Fiddler has been

When attempting to load a div tag using the .append() method, the styles are not loading correctly. Here's the code that was tested: <section id="year-2020" class="tab-panel"> <div class="row accordion"> <header> ...

Using Python's BeautifulSoup library to extract tables from archived HTML webpages

I'm currently working on extracting data from saved HTML webpages using Python 2.7 + Windows. There are several similar saved HTML webpages, each containing a table with 5 columns and an unspecified number of rows. The source code appears as follows ...

Changing the Color of a Table Cell with jQuery

I have designed a table cell in the following way <tr> <td id = 'even'>row 8, cell 1</td> <td id = 'odd'>row 8, cell 2</td> </tr> The colors and font sizes are defined using the CSS below #even { ...

Can you create a dynamic visual display using HTML5 Canvas to draw lines in a circular pattern that react

I have successfully implemented drawing lines around a circle using the AudioContext API. However, I am facing an issue with the lineTo function, as the line only grows and does not shrink. My inspiration for this project comes from the audio visualizer fo ...

Implementing Node.js with browser cache and handling 304 responses

I am currently in the process of creating a single page application with a standard HTML layout as shown below: <html> <head> <title>...</title> <link rel="stylesheet" media="all" type="text/css" href="css/main.css"> ...

CSS: Turn off the custom styling for radio buttons

My dilemma lies in the custom radio button I've created using CSS. The issue is that while I can select the radio button, I cannot deselect it. Here is a snippet of the CSS code I used to create the custom radio button: input[type="radio"]:checked:be ...

The navigation bar in Bootstrap 3.2 expands in size as you scroll past it

Whenever I reach the bottom of the page, the navigation bar suddenly enlarges. The navbar is located at the top of my code. I attempted moving the navigation to the bottom of the code... but it didn't fix the issue... Could someone please identify wha ...

Utilizing JavaScript Callbacks in HTML Image Tags

Currently I am working on a small application and looking to include a YouTube section. I have come across a method for obtaining the user's YouTube icon: This is included in the head section of my code: <script type="text/javascript" src="http:/ ...

Tips for inserting an image within a horizontal list of items

Struggling to find a solution here. I have a menu with a unique bar design between list elements, featuring breaks at the top and bottom. I attempted to use li:after in the CSS to insert an image, but encountered issues with padding and margin. Below is t ...

Enhancing spacing in Bootstrap 5 with additional spacers

Looking to enhance the spacers in Bootstrap 5 by incorporating it into Sass and customizing the variables. I'm aiming to avoid redundantly defining Bootstrap's spacer options, which are as follows: $spacers: ( 0: 0, 1: $spacer * .25, 2: $s ...

Create concise information in a single line with Twig

So, I basically need to display the following information inline on my website: Just like this: Family: Open Sans - Variant: Regular Italic Size: 15px - Line Height: 25px - Paragraph: 15px Color: grey_3 This is the code snippet: {% include "../compone ...

Having trouble with my HTML and PHP form submission. Can anyone help me figure out what's going on?

Hello, I'm in the process of creating a contact form for a website I'm currently working on, but I'm encountering some difficulties with properly configuring the syntax to send the form data to an email address. At the moment, I'm faci ...

Issue with PHP's ng-click not functioning properly with Angular JS's dynamic HTML generation

I'm just starting out with Angular JS. I'm trying to create an ng-click event in dynamically generated HTML from PHP, here's the code snippet. var app = angular.module('pageapp',[]); angular.module('pageapp') .filter(& ...