1,229 questions
3
votes
1
answer
76
views
Why does parent's aspect-ratio break with child's h-full but work with absolute?
I'm building a responsive MacBook screen component using CSS aspect-ratio, but I'm encountering a strange behavior where the aspect ratio gets distorted depending on how I position the inner content.
...
0
votes
0
answers
103
views
Safari 18.5 not respecting CSS aspect-ratio
I'm rendering a PDF page to a canvas, where I compute the aspect-ratio of the canvas's container element from the physical aspect ratio of the PDF page, before rendering it to the screen.
The HTML ...
0
votes
0
answers
52
views
only grow HTML block with aspect ratio if no blank space left at the bottom
I don't like when my HTML tooltips are disproportionally wide rectangles. On the other hand, a fixed max width makes tooltips with long text disproportionally tall rectangles.
How to make HTML block (...
1
vote
1
answer
152
views
Automatic image aspect ratio in react native
I would like to add an image to my app, which is built using the react-native framework with expo.
I want the Image component to:
fill the width of its parent component
fit the image's original ...
1
vote
1
answer
68
views
Fixed aspect ratio for a window on Tkinter
I need to find out how to keep a constant aspect ratio for a window on Tkinter.
I tried below code, but it only works when dragging bottom or top edges, but not for edges to the right or left. On all ...
0
votes
0
answers
69
views
ELEMENTOR PRO GALLERY - CUSTOMIZE ASPECT RATIO
since elementor pro doesn't have the choice to set the aspect ratio of the pro gallery to 3/4, i want to add it with a css code i found.
The gallery is the main page of my website.
This is the code:
....
0
votes
1
answer
88
views
How do I get my grids to stay consistently the same square dimensions as 1:1?
I am just a beginner to HTML and javascript so I haven't fully grasped the language yet. I have hit a brick wall and am looking for some help.
Click Here For The Situation
The problem is that I am ...
0
votes
1
answer
637
views
How to contain vertical YouTube video in Vidstack (without "more videos" UI)
By default, Vidstack zooms/crops a vertical YouTube video into a 16/9 aspect ratio:
If the height: 1000% styling is disabled, the vertical video is contained as desired. However, unwanted elements ...
1
vote
1
answer
103
views
Keeping aspect ratio of internal SVG
I have a root SVG element, defined as this (inserted at the top of the <body>):
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3....
0
votes
1
answer
226
views
CSS aspect-ratio not maintained when parent container's height exceeds limit [duplicate]
I'm working on a layout where a child element inside a parent container must always maintain a 16:9 aspect ratio. The parent container's size can be dynamically adjusted through JavaScript, and the ...
0
votes
3
answers
536
views
How to align a MAUI image with aspect-fill, within its display area?
Is there a way to align/position an <Image/> within its display area using Aspect="AspectFill" in .NET MAUI 8, or is there a workaround that produces the same visual result?
I'm trying ...
1
vote
1
answer
128
views
Why Does Modifier Order Affect the Positioning and Sizing of aspectRatio in Jetpack Compose?
Actually i am reading this answer , but there is not enough information about aspect ratio .
RectangleScreen :
@Composable
fun RectangleScreen(modifier: Modifier) {
Canvas(modifier.border(7.dp , ...
1
vote
1
answer
150
views
aspect-ratio in grid container is ignored by other columns
I'm encountering an issue with a CSS Grid layout that works as expected in Chrome but exhibits a problem in Firefox. Specifically, the second column of the grid seems to ignore the first column in ...
0
votes
0
answers
31
views
Aspect Ratio Cutting Off Map in Matplotlib
I have code that plots a map with user specified lat/long bounds. I use a defined map aspect ratio in order to keep the map at a constant size. If I don't my figtext moved well out of position. ...
0
votes
0
answers
13
views
How do I make an element with a set aspect ratio fill as much available space as possible without overflowing? [duplicate]
I have a div. I want to enforce its aspect ratio. As long as its set aspect ratio is preserved and my div is neither wider nor higher than the available vertical / horizontal space, I want it to ...
0
votes
3
answers
114
views
Combining object-fit: contain and hard-coded aspect-ratio on img
I am trying to combine object-fit: contains with aspect-ratio: 1.5 /* hardcoded number */ on an img.
The image remains square, however:
// Javascript for example resizing panels only.
const ...
0
votes
1
answer
488
views
Image in SwiftUI takes extra space at bottom while trying to set Aspect Ratio
I want to have Image occupying full width of its container and height will be based on aspect ratio provided explicitly. Also the image should cover all its frame and doesn't matter its content is cut ...
1
vote
1
answer
90
views
Why doesn't the flex child shrink in this simple test case webpage?
I had a webpage which was working perfectly and resized the child canvas element (the checkerboard with a bunny), while keeping its 1:1 aspect ratio with a help of ResizeObserver, when the browser ...
0
votes
3
answers
70
views
Flexbox issue when children are buttons using aspect-ratio
I’m using flex in a number input component to render custom “+” and “-” buttons next to the input itself. The buttons use aspect-ratio: 1/1; to ensure they are always square, but I can’t seem to get ...
1
vote
0
answers
102
views
Plotting a function in an SVG element : can the viewbox be the function plotting range?
I am plotting some math functions in the domain x: [0, 0.01], y: [0, 1] using JS and SVG elements.
My first approach was to scale the x-axis in order to have a "good" aspect ratio (for ...
0
votes
2
answers
90
views
Why is there a gap next to my CSS grid layout on some browsers?
I'm trying to use grids to display my pictures and make them cover the whole page while not changing aspect ratio. But when I open my page on Firefox or Chrome there's a huge gap on the right side.
...
-1
votes
2
answers
343
views
How to get correct and same aspect ratio of phone in landscape and portrait mode in Flutter?
I am using this code to get the aspect ratio
final deviceAspectRatio = View.of(context).physicalSize.aspectRatio;
It gives correct result in portrait but when I change the orientation in landscape ...
0
votes
1
answer
127
views
Use height:100% inside a div with aspect-ratio set - bug in certain browsers?
Note: This question about a new feature in CSS: aspect-ratio. Most of the questions on this site with similar keywords are about very different techniques.
Ok so there's a div with the following ...
1
vote
1
answer
114
views
Resizing Child Div Proportionally with Parent Container on Both Axes
I have a parent container with a child div set to an aspect ratio of 2/1.
When I resize the parent along the x-axis, the child scales accordingly. However, resizing along the y-axis doesn't affect the ...
1
vote
5
answers
781
views
CSS for banner element layout, to respect text content, maximum height and aspect ratio
I am trying to build out a banner element on a website, and am having an issue getting it to fulfil the criteria I am after. Ideally I would like to have a solution that is CSS only.
The layout is ...