Adjustable height to conform to all screen sizes

I need help designing a page that functions like a business card, displaying a picture and some details about the person. I have achieved a fluid width for the card, but now I want to make the height fluid as well so that it adjusts to different screen sizes. Any suggestions on how to achieve this? Here is the HTML code I am using:

<div data-role="page" id="my-page">
<div data-role="header"> 
    <h1>Page Title</h1> 
</div> 
 <div data-role="content" id="busCard">
    <div class="ui-grid-solo">
        <div class="ui-block-a"><div style="text-align:center" id="personName">John Doe</div></div>
        <div class="ui-block-a"><img id="personPic" alt="alt..." src="http://static0.therichestimages.com/wp-content/uploads/jack-nicholson-classical_160255-1920x1200.jpg" /></div>
        <div class="ui-block-a"><div id="personCat" style="text-align: center">CEO</div></div>
    </div>

    <ul id="my-listview" class="my-breakpoint" data-role="listview" data-inset="true" data-icon="false">
        // list items here
    </ul>   
</div>
<div data-role="footer"> 
    <h1>footer</h1> 
</div> 
</div>

Below is my CSS:

@media all and (max-width: 35em) {
        .ui-grid-solo img{
            width: 100%;
            float: none;
        }
    }

    // more CSS styles here

You can view a working example on Fiddle

Thank you!

Answer №1

You have the ability to define the main wrapper value.

#my-page {
       position: absolute;
       height:100%;
       width:100%;
       }

Afterwards, insert content within. It is not necessary to specify units like em or px for a zero (0) value. For instance, instead of "margin : 0em, 0em, 0em, 0em", you can simply write "margin: 0"

Answer №2

Your inquiry appears to be a bit perplexing since height is not typically incorporated in fluid layouts. Additionally, your CSS code seems to be disorganized.

However, if you eliminate all height attributes including min-height and simply modify the following line, your layout will appear flawless:

#my-page .ui-content, #my-listview {
        height: auto;   
        margin: 0;
        padding: 0;
}

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

Converting coordinates to pixel-based fixed positioning in CSS

After creating an animated square pie chart using basic CSS to display it in a grid format, I am now looking to transform the larger squares into a state map grid. Any ideas on how to achieve this? In my JavaScript code snippet below, I believe there is a ...

The script generated by document.write is failing to function as expected

A completed JQuery script has been created to enable the movement of a 360° object (picture) based on mouse actions. The code is functional: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title> ...

Label for the second text field does not shift with the material

I'm experiencing an issue with the label animation on my second text field not moving when focused. https://i.sstatic.net/Q2gFH.png HTML: <div class="mdc-text-field mdc-text-field--outlined"> <div class="m ...

Mysterious Loop in JavaScript Unfolding with Three.Js

In order to expand my knowledge of Angular and Three.Js, I am currently working on a prototype SPA that showcases different 3D elements rotating. There are several Angular templates accessible through a navigation menu, each displaying unique rotating elem ...

Tips for toggling the visibility of an element when a button is clicked in React

In my todo list, I need to display the details of each item when clicked on a button. There are two buttons available: "View Details" and "Hide Details". Below is the code snippet: class Todos extends React.Component{ construc ...

Choosing JavaScript

<select> <script type="text/javascript"> $.get( 'http://www.ufilme.ro/api/load/maron_online/470', function(data){ var mydata = new Array(); var i = 0; // индекс масси ...

Is it possible for a client to change the values stored in localStorage?

I'm exploring the use of localStorage instead of cookies to allow users to remain signed in on my website, as I dislike the use of cookies. My current plan is to store the user's username in localStorage, then have the site check if there is any ...

What is the best way to create CSS styles when Javascript is disabled?

Question about Styling: Embedding extra styles with noscript Define css if javascript is not enabled I'm looking to define specific CSS styles only when Javascript is disabled. Currently, I'm using the following code: <noscript> ...

jqGrid is throwing an error: undefined is not recognized as a function

Currently, I am in the process of trying to display a basic grid on the screen. Following the instructions provided in the jqGrid wiki, I have linked and created scripts for the required files. One essential css file, jquery-ui-1.8.18.custom.css, was missi ...

Arrange the contents within a div with Bootstrap 4 for proper alignment

Just stepping into the world of front end development and my question might come off as quite basic. Currently, I am delving into ReactJS. https://i.sstatic.net/o9tDo.png My current challenge is related to the following code snippet: <div className=" ...

Apply CSS to give each line of text a box shadow effect

My CSS notebook creation featuring box-shadow and margin can be viewed here: JSFiddle The issue I'm facing is that when a line break occurs, the notebook row expands, causing it to lose its notebook-like appearance. Is there a way to ensure each line ...

Initiating a video by floating over a container

This code snippet allows me to trigger videos to play when hovered over individually: //play video on hover $(document).on('mouseover', 'video', function() { $(this).get(0).play(); }); //pause video on mouse leave $(document).on(&ap ...

The art of breaking down a content list into pages using JavaScript or jQuery

I am looking to modify my webpage which currently displays 100 videos all at once on a single page. Is there a way to only show 20 of the videos initially and cycle through the rest using Next and Previous buttons with the help of jQuery or JavaScript? ...

Styling a playbook using CSS Grid management techniques

Exciting to create a playbook layout style, here's how it goes: Name: Text starting here - unique style #1 text that moves to a new line with a different look - unique style #2 more text continuing on another new line ...

Display the table upon completion of the form submission

I am trying to create a form where the table #mytable is only displayed after the form has been submitted. If nothing is entered in the form, the table should remain hidden. Any suggestions on how I can achieve this? <form action="" id="myform" method ...

Getting your JQuery ready() statement right is crucial for the proper

I have come across all three variations below: $().ready(); $(document).ready(); $(document.body).ready(); All of them seem to work, but I'm wondering which one is the most appropriate or recommended to use when considering the usage of the ready() ...

Is it necessary to properly close meta and link tags in HTML documents?

As I inspected someone's HTML, I noticed that they didn't close the meta and link tags in the head section. Surprisingly, the code still worked perfectly fine; does this mean closing these tags is purely optional? I always believed that leaving ...

Load iframe once to display on multiple HTML pages

In my web application, I have implemented an iframe that is used on multiple pages. My goal is to load the iframe once on the login screen and have it remain static when navigating to subsequent pages, without refreshing. Is there a way to keep a specific ...

Utilize a JQuery Function to target multiple div elements individually, instead of all at once

One simple thing to do is provide an example and a link. Essentially, I need to apply a Time Picker function to multiple inputs without having to create a new function for each individual div id. JSFiddle Link Currently, my code looks like this: $(fun ...

Scrolling multiple background images vertically within a div alongside text

Is there a more efficient way to create a vertical scroll like this without overcomplicating things? I feel like my approach is incorrect. https://i.sstatic.net/CRfqW.gif Currently, I have a div with a background image and the (1) / (2) / etc. positioned ...