Let's consider the following CSS property:
div {
display: grid
grid-auto-rows: 15% 70% 15%;
}
Does this imply that within the container, there will be three rows where each row occupies a percentage of the parent container's height?
Let's consider the following CSS property:
div {
display: grid
grid-auto-rows: 15% 70% 15%;
}
Does this imply that within the container, there will be three rows where each row occupies a percentage of the parent container's height?
Indeed, grid-auto-rows
dictates the height of implicit rows, which are generated by the grid to accommodate items that fall outside the boundaries of the explicit grid. Unlike grid-template-rows
, grid-auto-rows
does not automatically form rows.
https://www.w3.org/TR/css3-grid-layout/#implicit-grids
Yes, your grid-template-rows
rule will establish a grid with three explicit rows.
No, the percentage values in grid-template-rows
are not relative to the parent's height. They are tied to the height of the same element (the grid container).
You can experiment with this setup here: https://jsfiddle.net/2cxw0Lrn/
/* body { height: 100vh; } */
article {
display: grid;
grid-auto-rows: 15% 70% 15%;
grid-gap: 5px;
height: 100vh; /* disable and try body height above */
background-color: gray;
}
section { background-color: lightgreen; }
body { margin: 0; }
<article>
<section></section>
<section></section>
<section></section>
<section></section>
<section></section>
<section></section>
<section></section>
</article>
This behavior is outlined in the specification:
7.2. Explicit Track Sizing: the
grid-template-rows
andgrid-template-columns
properties
<length-percentage>
<percentage>
values are relative to the inline size of the grid container in column grid tracks, and the block size of the grid container in row grid tracks.
Referencing the spec will clarify terms like "inline" and "block" size, but the primary idea remains: the values are proportional to the grid container.
Currently, I have implemented the Superfish menu on my website. In order to indicate sub-menus within my menus, I have opted to utilize the character entity code >, which historically has represented ">". Oddly enough, while viewing my website ...
In my PHP application, I have incorporated a date selection feature within a modal dialog. However, when clicking the control, the calendar appears in the left corner of the page and remains visible even after selecting a date. Additionally, clicking elsew ...
I'm facing an issue with an element that is fixed to the top of the page and scrolls horizontally along with the page. The CSS code for this element is quite straightforward: .thing { position: fixed; top: 0; width: 100%; height: 30px; back ...
I am facing a challenge with my menu that needs to be concealed behind an arch design. https://i.sstatic.net/CwdjJ.png The objective is for the menu to appear hidden behind the black area, while still being visible over the blue arch in the background (a ...
When a list item is clicked, I want to clone it and display it in a separate div. If another list item is clicked, the previously displayed item should be replaced with the newly clicked one. Below is my code along with a link to the codepen where you can ...
Trying to position the SVG line in the center with the SVG icon, without overlapping them. Need a responsive solution that adapts to the container width. Any suggestions involving canvas or after pseudo classes? The line and icon should always be centere ...
I'm currently working on a basic modeling application for the web. The main component of my app is a canvas element that I'm trying to size correctly. However, when I set the height and width using CSS, it scales the entire canvas and compromises ...
I have a main layer with multiple layers stacked on top of it. I need the second layer to extend its width to match the body's width. Main Project: http://example.com What I've tried: I looked into: Solution for matching div width with body ...
I want to enhance the appearance of my popup window by applying a different format for opening it. How can I style it so that it looks visually appealing when the popup window opens? You can find below the source code I am working with: HTML: <div onM ...
Can an image convey more than a thousand words? I'm looking to align the second (and following) lines with the first one. Any suggestions? Html stands for <input><span>text</span> ...
Looking to incorporate the Supersized Fullscreen background found at Supersized Interested in having the slider appear on the right half of the site with content on the left half. Want the content to move when scrolled while keeping the background station ...
I am currently designing a web form for my wife, who works at an insurance agency. She needs a web-based form to collect information for processing insurance quotes. Without access to a server, I need to ensure that all the details inputted by the user can ...
Could someone help me differentiate between the [att|=val] and [att~=val] attributes in CSS? I'm having trouble grasping the concept. Thank you! ...
Is there a way to create a fallback in my CSS for changing the background image to a color when viewed on a mobile browser once the pixels reach the max-width? In the snippet below, the media query "only screen and (max-width: 600px)" works if the top bod ...
Is there a way to pass a variable to the "shadowColor" property in my stylesheet from an array declared in the code above? I keep encountering a "Can't find name" error. Attempting to use a template literal has not resolved the issue. Any assistance w ...
I am currently working on a unique "stack" component that is inspired by the amazing ElastiStack. You can check out a cool demo of my work here. The demo works flawlessly on desktop Chrome, but unfortunately, I have encountered some issues with the transit ...
My CSS file includes the following code: input.myInput { background-image:url('search.png'); background-size:120px 120px; } In my HTML file, I have the following input element: <input type='text' class='myInput' > I ...
Looking for advice on aligning or arranging a button and input box side by side in Bootstrap without grouping. I've searched online for examples, but they all involve grouping of elements. jsfiddle: https://jsfiddle.net/erama035/p9dagmL3/3/ <div ...
I am utilizing bootstrap 4, thymeleaf, and datatable I attempted to place a button on top of the table to the right <div class="col-sm-12"> <div class="float-right"> <button id="newUsers" type="button" th:onclick="@{/newusers ...
Can anyone help me figure out how to use the jquery .css() function without overwriting existing values, but instead adding additional values to css properties? For example, I have an element that currently has the css transform:translate(-50%, -50%). I w ...