+ 3
How do you avoid line breaks for a heading in CSS?
In HTML, when I have an <h1> tag for a heading, smartphones sometimes make line breaks on the text. Is there a way in CSS to avoid that? https://code.sololearn.com/WhibYT52G4FU/?ref=app
5 odpowiedzi
+ 3
To do that, all you would need to do is change the font-size of that element to something that would make it fit the screen size. Something like font-size: 80%; would work.
If you were wanting to make the font-size different based on the screen size, you could look into media queries and how they could be used in this situation ( https://www.w3schools.com/css/css_rwd_mediaqueries.asp )
+ 5
Thank you.
+ 3
I would want the font size to have a size that allows the text to fit on one line.
+ 2
How exactly would you want the text to appear? Would you want it to be able to scroll to the side to see everything or would you just want the font size to be a little smaller? There are a couple different ways to do that so there isn't exactly a definitive answer that would work in all scenarios
+ 2
Also, this will work
https://www.w3schools.com/howto/howto_css_responsive_text.asp