I can't find a solution to make the green elements start at the bottom right of the container, like in right image ("Need").
Does CSS provide a way to align/orient elements from the bottom?
"Default" and "Need" element's location illustrated.
SNIPPET
.cnt {
width:200px;
height:300px;
border:1px solid green;
text-align:center;
display: table-cell;
vertical-align: bottom;
}
.itm {
transform: translate(0px, 0px) scale(1);
display: inline-block;
padding:10px;
width:20px;
margin:10px;
background: green;
color: white;
transition:transform 0.5s;
}
.itm:hover {
transform: translate(0px, -3px) scale(1.1);
}
<div class="cnt">
<div class="itm">1</div>
<div class="itm">2</div>
<div class="itm">3</div>
<div class="itm">4</div>
<div class="itm">5</div>
<div class="itm">6</div>
<div class="itm">7</div>
<div class="itm">8</div>
</div>
Vertical text is common in graphic design, and can be a way to add a more interesting look and feel to your web design. The three possible values for the writing-mode property are: horizontal-tb: Top-to-bottom block flow direction. Sentences run horizontally. vertical-rl: Right-to-left block flow direction. Sentences run vertically.
For CSS, use vertical-rl instead. This example demonstrates all of the writing modes, showing each with text in various languages. The HTML is a <table> with each writing mode in a row with a column showing text in various scripts using that writing mode.
When we switch the writing mode, we are changing which direction is block and which is inline. In a horizontal-tb writing mode the block direction runs from top to bottom; in a vertical-rl writing mode the block direction runs right-to-left horizontally.
This should be enough to rotate text vertically from bottom to top, apply it on div containing the text. If you are using writing-mode: vertical-rl/lr in conjunction to this, that may be switching it to other way around. Show activity on this post.
Does CSS provide a way to align/orient elements from the bottom?
Surprisingly, in horizontal writing mode, it doesn't appear so.
There are various properties, including writing-mode
, direction
, text-orientation
and flex-direction
, that allow you to re-arrange the flow of content.
But none of them appear to allow the laying out of content in a horizontal writing mode starting from the bottom right. Maybe somebody could correct me on this.
In the meanwhile, here's a hack (pure CSS):
.cnt {
display: flex;
flex-direction: row-reverse;
flex-wrap: wrap;
align-items: flex-start;
align-content: flex-start;
justify-content: center;
text-align: center;
width: 200px;
height: 300px;
border: 1px solid green;
transform: scaleY(-1);
}
.itm {
padding: 10px;
width: 20px;
margin: 10px;
background: green;
color: white;
transform: translate(0px, 0px) scaleY(-1) scaleX(1);
transition: transform 0.5s;
}
.itm:hover {
transform: translate(0px, -3px) scaleY(-1.1) scaleX(1.1);
}
<div class="cnt">
<div class="itm">8</div>
<div class="itm">7</div>
<div class="itm">6</div>
<div class="itm">5</div>
<div class="itm">4</div>
<div class="itm">3</div>
<div class="itm">2</div>
<div class="itm">1</div>
</div>
https://jsfiddle.net/o7hr07k6/
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