Preventing Partial Overlap of Two Divs in HTML5

I found a template that caught my eye here: w3schools template

My latest project involves using this template to create a basic online shop layout with three main vertical sections: left, middle, and right. The left panel serves as a preview area for the selected product image. Meanwhile, the middle section displays various product pictures where selecting one changes the preview in the left area. Eventually, the right segment will show a summary table of all chosen products.

The issue I'm facing currently is that on desktop devices, there's an undesired overlap between the left and middle areas (right area features haven't been implemented yet). I would like to resolve this overlapping problem without compromising layout integrity. Any advice on how I can achieve this effectively?

* {
  box-sizing: border-box;
}

/* Styling for different screen sizes */
[class*="col-"] {
  float: left;
  padding: 15px;
  width: 100%;
}

.productImage > *{
display :block;
}

.productImage{
float:left;
}

@media only screen and (min-width: 600px) {   /* For tablets */
.col-s-1 {width: 8.33%;}
.col-s-2 {width: 16.66%;}
.col-s-3 {width: 25%;}
.col-s-4 {width: 33.33%;}
.col-s-5 {width: 41.66%;}
.col-s-6 {width: 50%;}
.col-s-7 {width: 58.33%;}
.col-s-8 {width: 66.66%;}
.col-s-9 {width: 75%;}
.col-s-10 {width: 83.33%;}
.col-s-11 {width: 91.66%;}
.col-s-12 {width: 100%;}

}

@media only screen and (min-width: 768px) {   /* For desktops */
.col-1 {width: 8.33%;}
.col-2 {width: 16.66%;}
.col-3 {width: 25%;}
.col-4 {width: 33.33%;}
.col-5 {width: 41.66%;}
.col-6 {width: 50%;}
.col-7 {width: 58.33%;}
.col-8 {width: 66.66%;}
.col-9 {width: 75%;}
.col-10 {width: 83.33%;}
.col-11 {width: 91.66%;}
.col-12 {width: 100%;}

.tableImage{
height:250px;
width:250px;
padding: 5px;
}

.productImage:hover{
background-color:#ddd; 
}
} 

.row:after {
content: "";
display: table;
clear: both;
}

.aside {
background-color: #33b5e5;
padding: 15px;
color: #ffffff;
text-align: center;
font-size: 14px;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}

.footer {
background-color: #f1f1f1;
padding: 10px;
text-align: center;
}


.chosenProductDetailsImage{  
height:550px;
width:400px;
padding: 10px;
background-color: white;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> 
<link rel="stylesheet" href="css/styles.css">
<script src="js/onlineshop.js"></script> 
<title>On-line shop</title>
</head>

<body>
   <div class="row">
 <div id="leftDiv" class="col-3 col-s-3">
<img alt="" id="chosenProductDetailsImageId" class="chosenProductDetailsImage" src=""/>
     </div>  

<div class="col-7 col-s-9">
<div class ="productImage">
<img src="images/product1.jpg"  alt= "Shirt" class="tableImage" onmouseout = "hideDetailImage();" onmouseover="showDetailImage(this)"/>
<input type="checkbox" id="NA823E08M-H11@6"  onclick="setAddedToCart(this)"  name="addToCart" value="Summer light skirt"/> 
<span class="addToCartSpan">Add to Cart</span>
<span class="priceAb">from <span class="price">$19.99</span></span>
</div>
...
</div>

</body>
</html>

Answer №1

segment, the focus is on altering the order of Media Query CSS and adjusting the width for a specific element with the class .chosenProductDetailsImage to be set at 100%. The CSS code provided within the snippet includes styles for responsive web design grids utilizing Media Queries based on different screen sizes such as mobile phones and tablets. It also defines properties for columns, images, backgrounds, and footer elements. Within the HTML structure, there are image containers for various products along with checkboxes for adding them to the cart, accompanied by pricing information. The layout features an aside section providing details about Chania, Crete, while the footer marks the end of the content. To enhance the visualization further, adjustments to CSS orders and widths could bring a refined look to the overall design and user experience.

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 production build encountered an issue as it was anticipating 3 arguments, however, it only received

import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'elipsis' }) export class ElipsisPipe implements PipeTransform { transform(text, length, clamp) { text = text || ''; clamp = clamp || '...& ...

How can I easily tailor Google Map designs for embedding on websites using iframes?

How do I customize the color of Map attributes within an iframe? <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3929.7682222383455!2d78.13052821529986!3d9.95323247656748!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x3b00c5e0 ...

Steps for importing selenium web elements:

Can all of these ... tags be extracted simultaneously? I aim to retrieve every ... from that particular webpage! Web address: 'https://school.programmers.co.kr/learn/challenges?order=recent&page=1' ...

Text within the <textarea> field is getting automatically indented

Recently delving into the realms of Mysql, HTML, and PHP, I've encountered a specific issue that seems to elude me in terms of finding relevant information. I'm working on my own project manager prototype and have incorporated a form that allows ...

Leveraging the amplify/reduce function with radio button selection

Please select from the following options: Using the up/down buttons in the main input should adjust the value accordingly. Clicking on any of the radio buttons below will update the price with the selected value. .priceBlock { width: 80%; border-r ...

Issue with overwriting variables in Bootstrap 5 has been identified

Attempting to customize default variables by replacing them with my own values. Utilizing the example code provided in the Bootstrap documentation: // 1. Begin by importing functions first (for manipulating colors, SVGs, calc, etc) @import "../bootst ...

Positioning an absolute element inside a relative parent with a defined maximum width

I am attempting to position #header-supporter at the bottom right of #header-image, with overlapping elements. The challenge lies in setting a max-width of 1280px on #header-supporter-cont to maintain consistency with the site's margins. I have tried ...

Looking to extract a particular set of information from past records in a GAS web application

Regarding a previous query I made before (Check for login username and password, and then bring data from every previous entry). I've developed a web application to monitor the working hours of employees at my organization. The app is straightforward ...

Exploring ways to customize the styles of MUI Accordion components in a Next.js project using CSS modules

I'm trying to customize the default MUI CSS for the accordion component using a CSS module. The issue I'm facing is that the class is dynamically added by MUI, making it impossible to target directly. Here's the solution I attempted, but it ...

How to verify the parent nodes in a jstree

I have implemented a two state jstree. However, I am encountering an issue where it is not possible to select any other node in relation to a node. My goal is that when I click on a specific node, all of its parent nodes should also be checked. Any assist ...

Showing an image in Django HTML: a beginner's guide

I have successfully created a functioning web page, but I am facing an issue with displaying images. Here is the structure of my directory: polls/ mountain.jpg templates/ polls/ index.html .everything else I am using this code in ...

Encountering issue with Django locating static file (1.5) showing ERROR 404 code 1649

I'm facing some difficulties in setting up my local Django site. I've reviewed the previous questions and answers, but haven't been able to find a solution. [20/Oct/2013 03:56:33] "GET /rides/ HTTP/1.1" 200 230 [20/Oct/2013 03:56:33] "GET / ...

Responsive design with Flexbox, interactive graphics using canvas, and dynamic content resizing

I'm having difficulties with my canvas-based application. I have multiple canvases, each wrapped in a div container alongside other content. These containers are then wrapped in an "hbox" container. The objective is to create a dynamic grid of canvas ...

I'm missing out on that gray background

input your code hereI am working with the following html/php code snippet: <div class="footerbottom"> <span class="footermenuitem"> <span class="footermenutitle">PRODUCTS</span> <?php $menu = menu_navigation_links('menu-pro ...

Launching a program through a web browser - a step-by-step guide

I am looking to create a specific sequence of events: A web browser opens, and a user logs in (the exact action is not crucial) The user is then redirected to a new page where another program should automatically open This process is similar to what happ ...

Seeking assistance in the development of a visual depiction of device orientation through JS

My goal is to visually represent the device orientation values alpha, beta, and gamma by creating a series of "bars" for each value. Currently, I have managed to display only the values in plain text using innerHTML. However, I envision these bars moving i ...

Having Trouble Styling Radio Buttons with CSS

Hello, I'm facing an issue with hiding the radio button and replacing it with an image. I was successful in doing this for one set of radio buttons, but the second set in another row is not working properly. Additionally, when a radio button from the ...

Tips for updating the text of an HTML element without deleting its children using JavaScript

Currently, I am implementing a code snippet to translate elements that contain the data-i18next attribute: const elementsToTranslate = document.querySelectorAll('[data-i18next]'); for (let i = 0; i < elementsToTranslate.length; i++) { ele ...

What is the best way to display a list of database records using Django?

Is there anyone who can assist me with this? I have a list of 60 records from a Django database in my HTML file. My goal is to display that list in a table with 6 columns and 10 rows. However, when using the {% for %} command in the HTML file, the list app ...

MVC.NET: Offering User-Friendly Loading of Initial x Items with an Option to Load More

What would be the optimal approach to efficiently load only the initial 25 elements from an IEnumerable within an ASP.NET MVC Index view? Upon employing scaffolding, a controller and views have been constructed. Within the index page, there is a creation ...