What steps can be taken to ensure that these divs are responsive?

Custom CSS styles:

.products {
    display: inline-block;
    position: relative;
    align-items: ;
    margin-top: -4px;
}
.product-cell {
    float: left;
    display: inline-block;
    width: 50%;
    box-sizing: border-box;
}
.product-img {
    position: relative;
}
.product-overlay {
    background: rgba(0, 0, 0, 0.73);
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: 0;
    z-index: 1;
}
p.product-name {
    position: absolute;
    top: 40%;
    color: #fff;
    z-index: 2;
    left: 38%;
    font-family: 'Kaushan Script', cursive;
    transform: translate(-30%,40%);
    font-size: 30px;
}
.product-list {
    padding: 5px 0px 0px 10px;
}

Your HTML code:

I am currently using Bootstrap, however, I am facing issues with the layout on mobile devices. I have attached images below to demonstrate the expected output and the actual output I am receiving on mobile. Can you please use jsFiddle to provide an explanation? Your help is greatly appreciated.

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

Expected output:

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

Actual output:

https://i.sstatic.net/5G2I7.png

<div class="products">
                <div class="product-cell">
                    <div class="product-img">
                        <img src="images/products-electronic.png" class="img-responsive" >
                        <div class="product-overlay"></div>
                        <p class="product-name">ELECTRONICS ENGINEERING</p>
                    </div>
</div>

Answer №1

To enhance the flexibility of your website, consider making it responsive by utilizing media queries, a form of additional markup within your CSS code.

If you are new to responsive design, Bootstrap is a highly recommended framework that can be easily tailored to suit your project requirements.

By implementing this framework, you will gain insight into how fluid grid systems can be integrated into your site for improved functionality.

I trust this information proves beneficial to you!

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

Maintain hover effect of main menu on sub-menu in CSS3 flip dropdown menu

Check out the fiddle I created for my query https://jsfiddle.net/e7te8hf1/ <section id="action-bar"> <div id="logo"> <a href="#"><img src="img/logo.png"></a> </div><!-- end logo --> <nav class="navbar navigat ...

Prevent user input in a text box once a radio button is clicked

I have been attempting to create a JavaScript function that will disable a textbox when a radio button is selected. I have four different options for the radio buttons, each with a corresponding textbox. However, even when I select radio button 2, I am s ...

Troubleshooting a CSS overflow problem in the main slider

While exploring the website , I encountered a minor issue. When I added "overflow: hidden" to the featured slider div, the images appeared stacked if JavaScript was enabled or the user's internet connection was slow. However, a new problem has arisen ...

What is the best way to ensure that all elements are perfectly centered in an

After conducting a thorough check, it has been confirmed that this post is not a duplicate. The circumstances surrounding my question are completely unique compared to other similar inquiries. I am working with an ASP.NET page that has an unspecified widt ...

Arrange database by website domain in PHP

I'm facing an issue where I need to extract domain names from a database and build buttons that can be used to sort the database based on these domains. For example, clicking on the Gmail button should sort users with Gmail accounts, and clicking on t ...

Bootstrap for handling screen rotation and responsive design

Utilizing bootstrap to showcase canvas thumbnails within a div for lighter client-side creation. While not the perfect design, it's functional. An issue arises when viewing the app on a mobile device in portrait mode - the col-xs-6 class remains fixe ...

I incorporated a CSS file from another HTML document. What do you think about that?

In my work with Ionic 3 and angular 4, each HTML file is accompanied by its own CSS file. There are times when I reference a class in one HTML file that is defined in another HTML file. I have observed that this CSS class gets injected into the main.js He ...

Retrieve the input value without a specified ID in HTML

After searching extensively, I have not been able to find a solution to my issue. I have a table that displays data from a database and in jQuery, I have successfully implemented a functionality where a row can be added with empty inputs and then submitted ...

How can I implement Jquery ajax calls in various JavaScript functions?

I'm encountering an issue with a particular function in my code function readComm(){ $.post("something.php", {read:"read"}, function(data){ retVal = $.trim(data).toString(); console.log(retVal); return retVal; }); } T ...

Include chosen select option in Jquery form submission

Facing some challenges with a section of my code. Essentially, new elements are dynamically added to the page using .html() and ajax response. You can see an example of the added elements in the code. Since the elements were inserted into the page using . ...

Having trouble displaying a list in HTML using ngFor syntax

I'm relatively new to angular and front-end development. I'm currently trying to make a call to a REST API in order to fetch a list of products, and then display them on the HTML page. product.component.html <div class="page-title"& ...

Is it possible to modify the inline onkeyup function?

Looking for a solution to change the onkeyup function in a textarea element from 255 characters to 150 characters without directly editing the code? <textarea cols="50" rows="4" id="textbox" onkeyup="limitArea(this, 255, '')"></textarea ...

Locating a particular table without an identifier

Recently, I've started working on a selenium project and I've encountered a roadblock. The webpage I am dealing with has three tables but I only need to extract data from one specific table. The challenge lies in the fact that all tables have the ...

Tips for enhancing the appearance of a dir-paginate

As a newcomer to AngularJS, I'm interested in learning how to apply styling to a pagination box. Below is the code for displaying a rectangular box view: ` <dir-pagination-controls max- size = "10" direction-links = "true" ...

Having trouble scrolling to the top in Flickr Search using AngularJS, the results are restricting my movement

I recently followed a tutorial on creating a Flickr Search App with AngularJS (https://www.youtube.com/watch?v=lvGAgul5QT4). I managed to show the search results on my page, but encountered an issue: I couldn't scroll all the way back up to the search ...

Styling a CSS triangle on the right side of a MaterialUI tooltip

Having an issue with the changing height of content in some tooltips. See how it's supposed to look here. I've attempted to address this problem by adjusting the design for both small (sample image) and big (sample image) content. This is the co ...

Troubleshooting Problems with Positioning and Floating in HTML and CSS

I'm facing some challenges with clearing floats (or it could be something else?). My goal is to have the #newsbar div free from the previous floats so that its width can extend 100% across the page/browser. I believe I've tried everything within ...

Text styling in HTML using a gradient effect

In the game LoR, players have the ability to edit their deck names using HTML code. As someone with no experience in HTML, I've noticed some players with gradient deck names and I'm struggling to figure out how they achieved this effect. The prob ...

Pandoc has removed all the line breaks in this text

I am currently utilizing pandoc for converting HTML to Markdown format. However, I have noticed that Pandoc tends to remove line breaks in the final output. Below is the command I am executing: pandoc -f html -t markdown_phpextra myfile.html Does anyo ...

Transparent background with opaque text

I noticed that my div has a gray background with some opacity. <div className="absolute w-full h-full top-0 left-0 right-0 bottom-0 bg-slate-500 opacity-50 z-10"> <p className="relative top-1/2 px-8 text-center hea ...