Adaptive Positioned Image Display

I currently have a Section with four blocks of content. Along the right-hand side of the screen, there are some images (as shown in this example) that I want to position absolutely. However, I am encountering an issue where these images overlap with the text when the screen width is reduced.

Is there a solution to prevent this overlapping behavior or perhaps a more effective approach to achieve my desired layout?

The code snippet below provides an outline of what I am trying to achieve:

.content-wrapper {
  position: relative;
  height: 100%;
  width: 100%;
  margin: auto;
  padding: 100px 0px
}

.content {
  width: 70%;
  margin: 100px 0px;
}

.place-1, .place-2, .place-3 {
  position: absolute
}

.place-1 {
  top: 5%;
  right: 0%;
  max-width: 30%
}

.place-2 {
  top: 30%;
  right: 5%;
  max-width: 30%
}

.place-3 {
  top: 65%;
  right: -15%;
  max-width: 30%
}
<div class="content-wrapper">
  <div class="content">
    <h2>Lorem Ipsum</h2>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit...
  ...convallis quam enim, sed lobortis erat vehicula sed...</p>
  </div>
  ...
  <img class="place-1" src="https://picsum.photos/500/500">
  <img class="place-2" src="https://picsum.photos/400/300">
  <img class="place-3" src="https://picsum.photos/700/700">
</div>

Answer №1

Your code needs some adjustments! The correct syntax for selecting multiple classes is to use a comma (,) in between the class names, like so: .place-1,.place-2,.place-3

.content-wrapper {
  position: relative;
  height: 100%;
  width: 100%;
}

.place-1,.place-2,.place-3 {
  position: absolute;
}

.place-1 {
  top: 5%;
  right: 0%;
  max-width: 30%
}

.place-2 {
  top: 30%;
  right: 5%;
  max-width: 30%
}

.place-3 {
  top: 5%;
  right: -15%;
  max-width: 30%
}
<div class="content-wrapper">>
  <div class="content">
    <h2>Lorem Ipsum</h2>
    <p>Lorem Ipsum....</p>
  </div>
  <div class="content">
    <h2>Lorem Ipsum</h2>
    <p>Lorem Ipsum....</p>
  </div>
  <div class="content">
    <h2>Lorem Ipsum</h2>
    <p>Lorem Ipsum....</p>
  </div>
  <div class="content">
    <h2>Lorem Ipsum</h2>
    <p>Lorem Ipsum....</p>
  </div>
  <img class="place-1" src="...">
  <img class="place-2" src="...">
  <img class="place-3" src="...">
</div>

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

The usage of CSS pseudo elements with the position absolute property

To allow for the opacity of an image to be changed without affecting the parent container's opacity, I added the image as a pseudo-element. The position of the pseudo-element is set to absolute and relative to the parent to position it inside the p ...

Arranging Divs in Bootstrap

Having issues with my Bootstrap layout where I have two divs: (A) set as col-lg-6 and (B) set as col-lg-6 on a large device. This currently displays as: (A)(B) I am trying to rearrange the order of these divs on a mobile or small device using col-sm-12 ...

`Carousel nested within tabbed interface`

I am currently facing an issue with my website's tabs and carousels. I have 4 tabs, each containing a carousel, but only the carousel in the first tab seems to be working properly. When I activate the second tab, all the carousel divs collapse. For r ...

What are the steps to embedding a Facebook video on a website?

Could someone please help me with embedding a Facebook video? I tried following the instructions provided at: https://developers.facebook.com/docs/plugins/embedded-video-player Unfortunately, I'm having trouble getting it to work. Here is the sourc ...

Is it possible to insert both the name and value of a complete attribute within an element using a string in Razor?

There is a common way to achieve this in asp.net MVC Razor Engine: @{ string myValue = "foo" } <h1 hello='@myValue'></h1> However, I am interested in an alternative approach that might result in an error: @{ string myAttri ...

Position the text alongside the Facebook emblem

I am having trouble getting the text Follow Us to align on the far right next to the Facebook Icon. I added the float:right property, but it is not working as expected. Here is the code snippet: <a href="#" target="_blank" style="font-family: Arial, ...

What is the best way to ensure that the text within Span children is properly laid out to match the width of the parent div tag?

This particular instance involves setting the width of the div tag to 200px and organizing all the span children to occupy the entire width of the parent div tag. If the first row is filled, the span tags should then flow into a second row. My attempt at ...

Stylesheets may not display correctly in Firefox and IE

Just wanted to say that I recently put together this little website , but I am completely stumped on why the CSS file won't show up in Firefox or IE. I know it's a basic question, but I'm still learning all of this. Thank you so much for a ...

Position the div element beside the image, rather than below it

I am having an issue with Bootstrap where the card I want to display on the right of an image is appearing below it instead. I attempted to use the display: inline-block property, but unfortunately, that did not solve the problem. I also explored other so ...

Black screen issue with JW Player on iPad

I am currently using the JW Player to embed my videos and facing an issue with them not playing on iPads or iPhones. It seems like a problem with the HTML5 video tag as the screen remains black when trying to play the videos. Below is the code snippet for ...

How can I use jQuery to pre-select an option in two connected dropdown lists that are populated with JSON data?

I am currently dealing with two interconnected dropdown lists for country and city selection. The options are populated using JSON data, but I've encountered a couple of issues along the way. The first issue is: How can I set the default selected opti ...

When the page loads, the HTML side menu will automatically scroll to the active item in a vertical

My website features a vertical side menu with approximately 20 items. The issue I am facing is that when a user clicks on an item, the destination loads but the side menu must be manually scrolled to find the active item if it's located at the bottom ...

Replace inline formatting with cascading styles

So, I'm currently working with a service provided by DRUPAL that has its own predefined style. I attempted to use CSS with the !important tag to override the existing style, but unfortunately it doesn't seem to be effective. The default style fr ...

The CSS dropdown menu is malfunctioning on Internet Explorer and Firefox

After searching for a solution and coming up empty-handed, I have decided to ask a question. The drop-down menu on my computer and other devices at home works perfectly in Chrome but not in Firefox and IE. #menu { position: absolute; left: 50%; bottom ...

What methods does a webpage use to track views and determine when content has been seen?

I am interested in learning about the code and mechanism that detects when a specific section of a webpage has been viewed (purely for educational purposes). For instance, on websites like StackExchange it tracks when someone has thoroughly read the "abou ...

Terminate a browser tab with the click of an HTML button

I'm facing an issue with my HTML button - I need it to close the tab upon clicking. Unfortunately, the common methods seem to no longer work on newer versions of Chrome and Firefox. I've tried using these two solutions but they did not work: & ...

Hide the element once the CSS animation has finished

I have successfully implemented an animation using pure CSS that starts on load. However, I am facing an issue with both opacity and visibility as the div continues to take up space even when hidden. Question Is there a way to make the div disappear comp ...

How can we use fetch to grab some data?

I put together an Express application quickly, here's how it looks: const express = require("express"); const app = express(); const port = 3000; app.get("/content/1/", (req, res) => res.send("Thinking about taking out a new loan? Call us today. ...

Issue with a Jquery toggleClass function not working properly on hover

Hello everyone! I am a newbie in the community and relatively new to the world of web programming. I am encountering an issue that is really frustrating me. I attempted to use this code to add a class when hovering over the ul list element so that I can d ...

Is there a way to keep Angular from automatically re-sorting my list when I make edits to it?

I have designed a small application with Angular for managing Todolists. Each list contains multiple todos, where each todo has attributes such as name, value1, and value2. To automatically sort each list using Angular, I utilized ng-repeat="todo in selec ...