Angular-Phonegap - The issue with "min-height: 100%" not functioning properly

I am faced with this specific HTML file:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <meta name="format-detection" content="telephone=no" />
        <!-- NOTE: Make sure to remove the width=device-width and height=device-height attributes for iOS 7 support. Reference: https://issues.apache.org/jira/browse/CB-4323 -->
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
        <link rel="stylesheet" type="text/css" href="css/platform.css" />
        <title>1001Carros</title>
        <script type="text/javascript" src="cordova.js"></script>
        <script type="text/javascript" src="js/angular.min.js"></script>
        <script type="text/javascript" src="js/angular-route.min.js"></script>
        <script type="text/javascript" src="js/angular-resource.min.js"></script>
        <script type="text/javascript" src="js/index.js"></script>
        <script type="text/javascript">
            document.addEventListener("deviceready", function(){
                angular.bootstrap(document, ['Application']);
            }, false);
        </script>
    </head>
    <body ng-view></body>
</html>

This is accompanied by a stylesheet:

/* Styles for different densities */
@import url('main-android-ldpi.css') screen and (-webkit-max-device-pixel-ratio: 0.9999999);
@import url('main-android-mdpi.css') screen and (-webkit-min-device-pixel-ratio: 1);
@import url('main-android-hdpi.css') screen and (-webkit-min-device-pixel-ratio: 1.5);
@import url('main-android-xhdpi.css') screen and (-webkit-min-device-pixel-ratio: 2);

 /****************************************************************************************************************
 * These styles are also applicable for iPhones - they need to be moved to a common CSS file eventually. *
 ****************************************************************************************************************/
html, body {
    min-height: 100%;
    margin: 0;
    background-color: green;
}

/*...*/

#block-content {
    background-color: #0058a9;
    min-height: 100%;
}

#block-footer {
    margin-bottom: 0;
    background-color: #bbbbbb;
}

#block-content-ender {
    clear: both;
}

/*...*/

In the imported files, specifications for

#block-footer, #block-content, html, body,
and #block-content-ender were not found.

The directive ng-view correctly injects the following content using ngRoute:

<div id="block-logo">
    <button id="btn-go-main" class="btn-blue-gradient"></button>
</div>
<div id="block-search">
    <div id="search-box">
        <div id="search-box-btn" ng-click="doSearch()"></div>
        <input type="text" id="search-box-text" ng-model="searchText" placeholder="Search e.g. Red, Chevrolet, Vitara" />
    </div>
</div>
<div id="block-content">
    <div id="floating-guys">
        <div id="tall-guy"></div>
        <div id="short-guy"></div>
    </div>
    <div id="main-menu">
        <ul id="options" class="menu">
            <li ng-repeat="button in buttons"
                ng-attr-id="button.id"
                ng-class="{'menu-row': true, 'section': button.section, 'clickable': !button.section}"
                ng-style="button.styles"
                ng-click="button.click()">
                {{ button.text }}
            </li>
        </ul>
    </div>
    <div id="block-content-ender"></div>
</div>
<div id="block-footer">
    Place for footer banner
</div>

Upon reviewing the styles, it is evident that html and body have a minimal height of 100% with a green background color for debugging purposes.

An observation worth noting is that

#block-logo, #block-search, #block-content
, and #block-footer do not belong to any specific tag in the document structure but are contained within the ng-view holder.

#block-content has been defined similar to html and body, except with a blue-like background color:

#block-content {
    background-color: #0058a9;
    min-height: 100%;
}

However, the intended behavior of setting the minimum height was not realized as expected. Despite the assignment of the min-height property, it did not have any effect at all.

Furthermore, the rest of the content and directives such as ngRoute operate seamlessly without any issues.

The perplexing question arises: Why does the #block-content fail to comply with the set height criteria?

A possible solution attempted involved nesting a div inside the body:

<!DOCTYPE html>
<html>
    <!-- -same head -->
    <body>
        <div id="content" ng-view></div>
    </body>
</html>

Accompanied by its distinct styling:

/* Specific style rules */
html, body {
    min-height: 100%;
    margin: 0;
    background-color: green;
}

#content { 
    min-height: 100%; 
    background-color: red; 
}

Unfortunately, neither attempt succeeded in achieving the desired outcome. Even with the distinctive styling applied to #content, it failed to display the intended behavior due to the green background seeping through from the body.

In conclusion: How can one enforce these 100%-height div elements to respond accurately?

Note: The primary concern lies in fixing the positioning of #block-footer to the bottom, ensuring it spans at least 100% of the device height to accommodate a footer-banner.

Answer №1

If you're facing issues with your height, it's important to remember that setting the html tag to 100% height is necessary. A child element can only inherit height properties from a parent if the parent has an explicitly defined height. Once the html tag has its height set, you can then assign min-height: 100% to the body.

As for positioning your footer at the bottom of the visual viewport, you can achieve this by:

footer {
    position: fixed;
    height: 100px;
    bottom: 0;
    width: 100%;
}

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

Is the sliding navigation glitching due to the video background?

Currently, I am in the process of developing a website with a captivating full-page video background. The nav menu gracefully slides out from the left side using jQuery UI when users scroll down to view the site's content. To view the work-in-progres ...

Using a combination of AND and OR in XPATH

Recently, I encountered the following HTML code: <div><h6>abc/h6><p>date</p></div> Using Selenium, I managed to locate this element based on text. However, the issue arises when <h6> can contain various words like "d ...

Incorporate this form created externally onto my website

I have been working on my website and I am looking to incorporate a form that opens up once the login button is clicked. This form was generated using an online form builder which provides an embed code for seamless integration onto websites. Below, you wi ...

How can you eliminate a line from the HTML input mask in Gravity Forms?

With Gravity Forms, I am utilizing the "input masks" feature to prompt users to enter data in a specific format. However, it seems to be creating an unwanted line within the input field itself as shown in the image below: https://i.stack.imgur.com/8gQ3K.j ...

Executing an AngularJS function using regular JavaScript code

I am currently working with AngularJS and Typescript. I have integrated an external library into my project and now I need to call an AngularJS method from that library, which is written in vanilla JavaScript. I tried following this example, but unfortunat ...

What are some ways to slow down the speed of a canvas animation?

I am currently working on an animation project using JavaScript and canvas. I have a reference fiddle where objects are generated randomly and fall from the top right corner to the bottom left corner, which is fine. However, the issue is that the objects a ...

Learn how to dynamically highlight a table row when any changes are made to it using jQuery

Is there a way to automatically highlight the current table row when any input text or image is changed within that specific row using jQuery? In the given code snippet below, with two rows provided, how can one of the rows be highlighted upon modifying ...

How can I output HTML code using php echo without using quotation marks?

My issue involves printing out HTML code that is not stored as a simple string, requiring me to decode it before echoing. The problem arises when I echo the decoded value and unwanted quotes appear, disrupting the output. Here's an example: <div> ...

What is the process for including a new column in a table created using the FixedTable jQuery plugin?

I'm a beginner with the jQuery FixedTable extension. How can I insert a new row into a table that already exists? I need guidance on how to accomplish this task. ...

Is there a way to retrieve the modal's viewport height in Angular?

Is it possible to determine the viewport height of my ng bootstrap modal within my Angular application? Here is what I currently have: I have a modal with CSS styling as shown below: .modal-xxl { width: 95% !important; max-height: 90% !important; ...

Adding alpha or opacity to the background image will give it a unique and

Is there a way to darken the background image while keeping the text color the same? Check out this code snippet on JSFiddle div { display:block; background:url('http://placehold.it/500x500') 0 0 no-repeat; background-color:rgba(0 ...

Why isn't the selected option appearing first?

I have written a PHP code to display the specified div <div id="main_catsel"> <select id="maincat" > <option value="1">none</option> <option value="2">Computer</option> <option value="4">Refrigerator& ...

Using jQuery in Rails 3 to display the id of a td element

I am working with a 3x3 table that contains td elements with unique id's (id='a1'...id='c3'). I want to enable the user to click on any of these 9 td elements and receive an alert displaying the id of the clicked td. Below is my C ...

When viewing the material-ui Chip component at normal zoom, a border outlines the element, but this border disappears when zoomed in or out, regardless of

Edit I have recently discovered a solution to the unusual problem I was facing with the material-ui Chip Component. By adding the line -webkit-appearance: none; to the root div for the Chip, the issue seems to resolve itself. However, this line is being a ...

Responsive menu not collapsing properly and appearing funky in Drupal

I've managed to create a responsive navigation bar, but I'm encountering two issues. Firstly, when I resize the screen on my test pages, not all of the links hide as expected. Secondly, after inserting the code into Drupal, the nested links appea ...

Assign values to several variables when ng-click event is triggered

Is there a smart way to assign values to multiple variables within an ng-click statement in a view without using a controller function? For instance, something like <li ng-click="showLeftDiv = true, showRightDiv = false, showBottomDiv = false"> I ...

Mobile phone experiencing issues with background loop video playback

<video autoplay muted loop id="videobg"> <source src="bgvideo/bgvideo.mp4" type="video/mp4"> </video> I have a background video on my website that works perfectly on desktop but not on iPhone. You can c ...

Leveraging ng-model with expressions in ng-repeat in AngularJS.Would you

Currently, I am tasked with creating a form for a multilanguage content management system using angularJS. The language list has been defined within the angular scope as follows: $scope.languages = [ {id:0,'name':'English'}, {id:1, ...

Image broken despite accurate file path in next.js and tailwind

https://i.stack.imgur.com/2ZqPa.png In my components folder, specifically in navbar.js, I have a path to the image folder <img className="block lg:hidden h-8 w-auto" src='../images/logo_injoy.png' alt="Logo" /> U ...

Using JQuery to conceal floated divs

I'm facing an issue that I had resolved the last time I worked on this website. However, I am currently redesigning it to include additional elements, and I am struggling to make the jQuery part function correctly. Essentially, I have an HTML documen ...