Not sure, but I seem to recall that there was a way to represent the values of top, right, down, left of positioning in css, like this format: positioning: top right bottom left, much like the order of a clock (clockwise). Ex: Positioning: 10px 20px 10px 30px;
As an alternative to setting the positions in this way?
<style>
body {
position: relative;
top: 10px;
right: 20px;
bottom: 10px;
left: 30px;
}
</style>
Can anyone help me figure out what I am recalling?
yes, it's called inset
This shorthand property sets the top, right, bottom, and left properties. Values are assigned to its sub-properties as for margin. ref
.box {
position:fixed;
inset:20px 50px 50% 10px;
/*
top:20px;
right:50px;
bottom:50%;
left:10px;
*/
background:red;
}
<div class="box">
</div>
If you read the specification I linked you will also find more sub properties related to inset called Flow-relative Offsets
The
top,left,bottom,rightphysical properties, theirinset-block-start,inset-block-end,inset-inline-start,inset-inline-endflow-relative correspondants, and theinset-block,inset-inline, andinsetshorthands, are collectively known as the inset properties.
CSS introduces the concept of flow-relative property/value to make it easier to deal with different writing modes and directions:
Related: What is the difference between margin-block-start and margin-top?
We can also transform existing property to become relative using the logical keyword
The shorthand properties for margin, padding, and border set values for physical properties by default. But authors can specify the
logicalkeyword at the beginning of the property value to indicate that the values map to the flow-relative properties instead of the physical ones.
This one is still far from having any support: https://github.com/w3c/csswg-drafts/issues/1282
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With