Creating a single div to overlay two divs solely for mobile devices can be achieved by using media queries and absolute

Creating a mobile-friendly page seems to be a challenge for me.
I want to have header text, top and bottom text, and an image of a phone that hovers over both texts.
I attempted this using Twitter Bootstrap, but I struggled with the overflow property in CSS.
Here's what I'm aiming for: https://i.sstatic.net/Lfhxe.png
And here's what I ended up with: http://plnkr.co/edit/t6w3MtoiD4KUuGe0mM10?p=preview
You can also view the messy code right here:

    <style type="text/css">
        .text p {
            padding-left: 15px;
        }
    </style>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
</head>
<body>
    <div style="position: relative;">
        <div class="row" style="background-color:#E4F6FC;">
            <div class="col-md-3" style="margin:10px">
                <p>Logo</p>
            </div>
        </div>
        <div class="row " style="background-color:#E4F6FC;">
            <div class="col-md-3 " style="color:#00AAE3;width: 100%;padding-right:0;height: 100%;position:absolute;z-index: 11;top: 0;left: 0;margin-top: 15%">
                <p>My</p>
                <p>default</p>
                <p>text</p>
            </div>
            <div class="col-md-3" style="padding:0;height: 100%;top: 0;left: 0;margin-top:-5%;float:right;z-index: 12;">
                <img src="http://i.imgur.com/qYV93nS.png">
            </div>
        </div>
        <div class="row">
            <div class="col-md-3 text" style="padding-top:10px;padding-bottom:10px;color:#FFFFFF;background-color:#00AAE3;padding-right:0;height: 100%;top: 0;left: 0;z-index: 10;top: 0;left: 0;margin-top:-45%">
                <p>and few</p>
                <p>lines of great</p>
                <p>lorem ipsum</p>
                <p>here</p>
                <button type="button" style="margin-left: 15px;border-radius: 20px;border-color: #FFFFFF;background: none;color:#FFFFFF;" class="btn">
                    AWESOME BUTTON
                    <i class="fa fa-angle-right"></i>
                </button>
            </div>
        </div>
    </div>

I apologize for the mess you've seen and any damage caused to your eyes :с

Answer №1

Here are a couple of suggestions to help improve your layout:

1) Consider using absolute positioning for both your phone and text elements to ensure they stay in the same place. Make sure to adjust the z-index property so that the phone appears on top.

2) It seems like the issue with your layout may be due to the col-md class not being compatible with smaller screens like smartphones. Try using col-sm and col-xs classes for screens under 749px. Also, take advantage of the new 12-column grid system for better alignment. For example:

<div class="col-lg-2 col-md-1 col-xs-1"></div>

I hope these suggestions help guide you in the right direction, as I'm unsure of your exact goal with the layout.

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

Issue with displaying checkboxes in the dataTable table

I am currently working with dataTables and encountering difficulties displaying checkboxes on my tables. Below is the code that I have: <table id="employeeList" class="table table-sm table-bordered table-hover" cellspacing="0" width="200%"> &l ...

Tips for positioning a div to match the height of its parent div

How can I make a div stretch to the height of its parent using Bootstrap 3.0.2 without using a script? Check out the fiddle linked below. In this example, I want to stretch the blue container to match the height of the parent green container. View Fiddle ...

Guide to playing multiple audio files on a single HTML5 page

I am facing a unique scenario with multiple html5 audio players embedded in an html table structure. <tr> <td> <audio controls><source src="file1.flac" type="audio/flac"></audio> </td> </tr> <tr ...

Utilize the power of Vuejs' v-for directive to populate not only the table rows, but also its header with

Can a single object be used to populate both table headers and rows? I attempted to do so with the code below: <table v-for="(table, index) in tables" :key="index"> <thead> <tr> <th> {{ table. ...

Problem with layout design (utilizing float properties)

I'm curious why the paragraph content gets sandwiched between two floated divs. I'd like the paragraph content to appear below the header. Also, why aren't the line breaks showing in the paragraph? Check out this JS Fiddle link for referenc ...

Progressive computation depending on the size of the window in Cascading Style Sheets

Is there a way to dynamically calculate the left percentage in CSS based on the window width? For example: if width > 700px: left: 30% if width > 800px: left: 32% Any suggestions on how to achieve this effect? ...

The scrolling content is positioned beneath the primary header and navigation bar

I'm currently in the process of designing a website where, upon clicking a navigation button, part of the page scrolls while the top header & nav bar remain fixed. Although I've managed to get the scrolling functionality to work and keep the top ...

Update the value of an ASP textbox using JQuery, and ensure that the .Text property accurately reflects the new value

After searching extensively, I still haven't been able to find a solution to my problem. I am facing an issue with updating a readonly Textbox in ASP.NET using JQuery after selecting radio buttons. The value displays correctly and everything seems to ...

Exploring external URLs beyond your Django website

Imagine you have a Django site with numerous buttons and links that all lead to . Instead of manually typing out the URL each time like this: <a href="http://stackoverflow.com" target="_blank" rel="noopener"> Is there a way to simplify this proces ...

The dropdown menu does not automatically align with its parent element's position

<div className="inner-dark-section"> <div className="search-section" style={{ width: "100%", position: "sticky", top: "0", ...

The data variable in Vue.js does not show up in the view even when it is populated through an AJAX request

I am facing an issue with my code, where the 'tarefas' variable is not appearing in my v-for loop. I have verified that the response from the server is correct and the data is being received. Interestingly, when I add new data in the input field, ...

Creating a Masonry Slider with varying heights and widths of images is a simple and effective way to showcase diverse content in a visually

I am looking to implement a unique grid image slider that accommodates images of varying heights and widths. I envision something similar to the example shown below. The image showcases a pattern where the sliders alternate between square images and two r ...

How to ensure product images keep their size and aspect ratio in Weebly

Currently, I am running into issues while using Weebly to create an eCommerce website. The problem lies with the product element images - they seem to be appearing twice the size of the original upload. Unfortunately, I do not have access to any other imag ...

What steps can I take to deactivate input and stop it from being accessible on the browser?

insert image description Is there a method to block users from accessing disabled input fields in the browser? Any recommendations or solutions would be greatly appreciated. Vuejs is utilized within my project. Implementing this feature serves as a secu ...

Extracting information from the database and incorporating it into an HTML webpage

I am facing an issue where I am attempting to fetch data from a MySQL database using PHP and display that data on an HTML webpage. However, the page appears blank and nothing is being written to it. I have recently changed the password for localhost phpMyA ...

Ways to bypass a customized CSS element and opt for the original one under specific circumstances

I have a customized Bootstrap file that alters certain components, however, I am encountering issues with it especially when transitioning to Bootstrap 4. The problem arises in specific scenarios and I would like to revert back to using the original Bootst ...

Challenges encountered while using colspan in CSS tables

I'm looking to create a table layout where the first column appears twice as wide as the other two columns. However, when I use colspan=2 in the table, it doesn't have the desired effect. Check out the code in action: http://jsfiddle.net/US96B/ ...

Troubleshooting problems with the masonry layout in HTML (asp.net)

I'm working on my website and trying to implement masonry to achieve a nice layout for my content. However, I've been encountering some strange results so far. Below is the code I'm using: <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 ...

Mastering the art of seamlessly merging the gradient in the foreground with the background

I want to achieve a unique rainbow gradient effect using only CSS, overlaying it on top of an existing background. The main objective is to make the rainbow fully opaque at the center and gradually transparent towards the edges, seamlessly blending with th ...

What is the best way to retrieve the value from a textarea and verify if it is blank or not?

I have successfully incorporated a textarea using simpleMde, but I am facing difficulty in retrieving the value and checking whether it is empty or not. var message = document.getElementById("simpleMde").value; console.log(message); <textarea class=" ...