How to right align text with linebreaks in HTML FlexBox [duplicate] - html

This question already has an answer here:
Right-align elements on multiple rows
(1 answer)
Closed 4 years ago.
I'm working on a website with HTML and want to vertical align the content of a label using FlexBox.
As long as the contents have no inside it works fine.
But when i got a content like
Right<br/>Bottom<br/>24
the content is handled as a block which is right aligned, but the individual parts of the content are not right aligned at all.
I get per example:
Right
Bottom
24
instead of
Right
Bottom
24
Here the style which i'm using for the label:
display: flex; justify-content: flex-end; align-items: flex-end;
Have i forgotten something in the style?

you should put your content inside HTML element's because flexbox is not ment to work with just text if you wanna aplly your structure on a text use css columns instead of flexbox.

Related

How to align and justify items in a column in flex display using CSS? [duplicate]

This question already has answers here:
Equal width flex items even after they wrap
(2 answers)
Closed last month.
I was trying to create a side menu for my website and I have used flex property for the items in it but they don't look right with the current alignment, so I wanted to change the alignment and its justification but couldn't do it.
I tried different properties like align items, align text, align content, and even justify content and justify items but none of them helped me.
I want to align the items to left and justify it to make it look better.
This is the link of the repository in github: https://github.com/abhishek12221732/Music-Mania.git
The image of menu I am getting
Add:
align-items:flex-start;
To the flexbox containing the menu (in your code this is the div with the class of "leftmenue". To do this add align-items: flex-start; to this class in your mm.css file.
As other have said, it's best to copy (a piece of) your code here to github so that people can easier diagnose the problem and help you.

How do I develop this kind of responsive bootstrap (or HTML CSS) layout without JS script? [duplicate]

This question already has answers here:
Align child elements of different blocks
(3 answers)
Closed 2 years ago.
Since I'm not a native English speaker its difficult to explain the problem with words. Please refer to the image I will explain to my problem below.
Currently, I'm using bootstrap 4, But If this can be done by pure CSS HTML that's also fine.
The issue is the column card's title and paragraphs words count different to each column card. But these things must be archive developing the layout.
All titles should align to the top & should be in the same line.
All paragraphs should align to the top after the title but all paragraphs should be aligned in the same horizontal line.
All buttons (Green squares) align to the bottom of the card.
I have done this using min-height in CSS. But when it comes to short titles & short paragraphs. UI is not so great.
Please show me the direction how to do this.
Thanks in advance.
The way I see it, you'll have to combine bootstrap card and Flexbox to achieve this. Or you can just use flexbox and put the element into each flexbox and justify-content: flex-start; and align-content: space-between; for it.
User overflow properties when length is more than a height on your paragraph, or try #media queries when the window's width is more than 992px
Links:
https://www.w3schools.com/css/css3_mediaqueries_ex.asp
https://www.w3schools.com/css/tryit.asp?filename=trycss_overflow_intro

how do you make a flex item fill the remaining space? [duplicate]

This question already has answers here:
Fill the remaining height or width in a flex container
(2 answers)
Closed 4 years ago.
Hey Guys I'm making a job application form for a website. I'm using flexbox for the layout but on <div class="row row-9"> I have one label element that sits on the left side and one input element on the right side. I'm using justify-content: space-between; to separate them apart. However I want the input field to expand to fill all of that empty space. Would i do this with the width property? Also Am I even making this form right I have s many css rules with one property and the html doesn't look good either. I've only made one other form before. Thanks for your help:)
https://jsfiddle.net/wpm1crtz/1/
input{
flex:2
}
Or however width You want to make the the input.
for example if you put flex:2 , it will essentially take up 66% of the row,
flex:1 would take up 50% etc.

How align a block vertically with flex in css so that it will be responsive [duplicate]

This question already has answers here:
Centered elements inside a flex container are growing and overflowing beyond top [duplicate]
(3 answers)
Can't scroll to top of flex item that is overflowing container
(12 answers)
Closed 4 years ago.
I am new to flexbox and now I am trying to align items both vertically and horizontally. I started to google and found quite enough answers. All of them are based on the same strategy: to add some css rules to parent block:
display: flex;
align-items: center;
justify-content: center;
But I also want so that parent block was 100% height of window. So I made 100% of html, body and parent block. From the first sight everything works. But then I noticed a problem. When I shrink a browser so that child block does not fit browser window, top part of child centerd block is not visible.
Here is an example. When you open it you see red top border. But if you decrease size of the area for displaying so that the square does not fit that area you do not see a top border. It is lost.
I saw this answer but the problem also exists in the first accepted answer. What should I do to resolve this?
Update
Here is what I get:

Center align flexbox container unless content overflows viewport [duplicate]

This question already has answers here:
Can't scroll to top of flex item that is overflowing container
(12 answers)
Closed 7 years ago.
To vertically and horizontally center a div with flexbox I simply apply these rules to it's parent
display: flex;
align-items: center;
justify-content: center;
So that it will be displayed like so:
However when there's more content in the div then there is height in the viewport, it makes the content overflow the webpage so it isn't visible, and impossible to scroll up- like so: jsfiddle.net/xk1z6wpa/2
I need the div to not overflow the webpage from the top, rather stopped before reaching it thus only overflowing from the bottom- like so:
How can I accomplish this?
I think your only option is to throw a little JS in.
$(".content").css({
'margin-top': Math.max($(".content").height() - $(window).height(), 0)
})
This pushes the content to the top of the page unless it would result in a negative margin, at which point the expression evaluates to 0.