dimensions of an element in percentage using css and html, accompanied by some peculiar attributes

I encountered an issue with some CSS and HTML code. The code works perfectly fine in Chrome and Firefox browsers, but when I try to inspect it using developer tools on mobile view, the min-height:100%; property does not seem to be applied. I have attached a screenshot for reference. It's strange that it works in normal browser view but not in the developer tools. Any insights on why this might be happening? Thank you!

*,
*::before,
*::after {
  box-sizing: inherit;
}
* {
  position: relative;
}
a,
body,
footer,
header,
h1,
h2,
html,
img,
li,
p,
section,
span,
sup,
ul {
  background: transparent;
  border: 0;
  font-size: 100%;
  margin: 0;
  outline: 0;
  padding: 0;
  vertical-align: baseline;
}
html {
  box-sizing: border-box;
  height: 100%;
  overflow-x: scroll;
  overflow-y: hidden;
  width: 210%;
}
body {
  background: red;
  color: #FFFFFF;
  height: 100%;
  margin: auto;
  overflow: hidden;
  width: 210%;
}
section {
  display: block;
  float: left;
  height: 100%;
  width: 100%;
}
.test {
  float: left;
  min-height: 100%;
  overflow: hidden;
  width: 20%;
}

Answer №1

When the chrome dev tools are opened inline, the min-height is being recalculated. Take a closer look at the red section's height on the page – you'll see it matches the height of your dev tools window. To solve this problem, open the dev tools in a separate window.

Alternatively, consider utilizing viewport height instead of percentages. Replace 100% with 100vh.

Answer №2

When reviewing your initial inquiry, it appears that

</style><head><body>
was entered instead of
</style></head><body>
(please note the inclusion of the backslash before head).

Rectifying this discrepancy should likely resolve the problem at hand.

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

Using HTML in jQuery or JavaScript: A Step-by-Step Guide

Here's the deal - I've got a bunch of buttons. https://i.sstatic.net/839MH.png What I want is, when the 4th button is clicked, to trigger a select menu option like this: The outcome I'm aiming for after clicking the button is https://i.ss ...

Ways to add stylistic elements to variables using JavaScript

I'm currently working on an API and I've managed to get it up and running, but now I'd like to add some style to it. I've been attempting to change the style for variables such as title, country, status, and summary but haven't ha ...

Add a layer on top of the background in order to cover the entire screen

After researching various SO questions and answers, as well as examining different JSFiddle and Codepen examples, I have yet to find the solution I am looking for... Here is a sample fiddle of my current issue: https://jsfiddle.net/ts4t13hn/3/ Below is ...

A step-by-step guide on using Javascript to transform images into text

Hey there! I'm looking for some help to convert an image into text. The idea is that when someone uploads an image and hits the "Submit" button, the text from the image should display in a textarea below. However, the code I've been working on do ...

After submitting in Moodle, the form fails to validate

I have been working on a form that adapts its structure based on the parameter in the URL. If no parameter is provided in the URL, an error message should be shown. Depending on the ID, a database query is executed, and the form is populated with data. Fo ...

Using a Mixin as an Argument in Another Mixin in LESS CSS

Is it possible to pass the declaration of one mixin or style to another mixin as an input parameter? Consider the following example involving animation keyframes. This is how keyframes are typically defined in pure CSS: @-moz-keyframes some-name { fr ...

the inline-block display property is not initializing properly

I am facing an issue with positioning two divs next to each other. Initially, using the display: inline-block; property for both divs worked fine. However, as soon as I added a <p> tag into one of the divs, its placement got messed up. Here is the cu ...

Elm div contenteditable loses cursor position after content update

Is there a way to maintain the cursor position while typing in a contenteditable div? I'm utilizing Elm to generate a text box and require the text within it to undergo processing with every input. The rationale behind opting for a contenteditable di ...

How can I retrieve the value from an input form using jQuery if it returns null?

Despite trying various methods, I have been unsuccessful in retrieving form values using jQuery and sending them in an AJAX GET request. The value keeps showing as null even after spending more than 18 hours on it. Any help would be greatly appreciated. $ ...

Custom validation for Stripe checkout form

Currently, I am working on setting up a customized Stripe checkout where the total amount is dynamic based on the user's selection in the "isStudent" radio button. Additionally, there is a form on the page that needs to be validated before submission, ...

Triggering a system context menu through a longpress gesture on the MobileFirst iOS app is a

After experimenting with our MobileFirst iOS app, I noticed that if you hold down on any anchor links for more than 2 or 3 seconds, iOS will bring up a built-in menu displaying the internal path of the current HTML page. I'm unsure whether this behav ...

The JQuery .replaceWith method exclusively offers unprocessed HTML content

I'm experiencing a minor issue with my ajax response where it returns raw html and does not execute any scripts, resulting in the jquery ui scripts not being executed. Here are some details: I am currently working with ASP.NET MVC and I need to comm ...

troubleshooting problem with bootstrap 4 form submission

I am currently working on a website using bootstrap 4 and have added a form. After uploading it to my server, I tested it and it seems to be working, but with some issues. The form consists of four fields: first_name, last_name, email, and phone. While the ...

What is the process for adding personalized arrows to a slick slider that switches images when hovered over?

I'm currently utilizing the slick slider from . My goal is to have my custom arrows change appearance when hovered over. Below you will find the JavaScript code I've implemented to customize the left and right arrows within the slider. However, ...

What is the best way to trigger the selection options in a dropdown menu with several buttons?

Is it possible to display the options from a select-option tag using a different button? I have either a div or another button. I want to be able to show the list of options from my select tag by clicking this button. Here is my select tag: <select&g ...

Setting the maximum width for all readable text (excluding tables and similar elements)

While I typically avoid using style sheets and similar tools, there is one crucial reason to implement a fixed layout: the importance of maximum text line width for readability. Lines that exceed a certain character count are difficult for humans to read. ...

Utilize Thymeleaf to reuse a template with dynamic URLs generated by various controllers

I have two HTML templates that serve the same purpose but are managed by two different controllers: The first HTML template is handled by the moderator controller <form th:action="@{/moderator/new-user-form}" th:object="${caltest}" method="post" ...

Is there a way to trigger a Random Number function once the <div> element returns to its initial position?

For this single serving site, the concept involves swiping a card over a specific area to receive different messages depending on interaction with the droppable space. I am looking to implement an if else function that utilizes a random number variable to ...

If an input type="file" is empty, then $this->form_validation->run() will return false

Whenever I make changes to my settings and leave the input type="file" empty, $this->form_validation->run() consistently returns false. Surprisingly, I haven't utilized setrules or required it. Below is the snippet of my code: public function ...

Playing HTML5 videos in Safari 5.0.5 is encountering issues with MP4 files

Working on an Intranet application where most users utilize Safari 5.0.5 on Mac OS X 10.6.8. The application needs to display various mp4 videos using the HTML5 video tag. The web server supports streaming by accepting ranges. The HTML markup is as follo ...