+ 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

16th Jun 2019, 8:26 PM
androidCoder255
androidCoder255 - avatar
5 Réponses
+ 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 )
16th Jun 2019, 8:52 PM
Faisal
Faisal - avatar
+ 5
Thank you.
16th Jun 2019, 8:54 PM
androidCoder255
androidCoder255 - avatar
+ 3
I would want the font size to have a size that allows the text to fit on one line.
16th Jun 2019, 8:50 PM
androidCoder255
androidCoder255 - avatar
+ 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
16th Jun 2019, 8:47 PM
Faisal
Faisal - avatar
16th Jun 2019, 11:31 PM
Chris Coder
Chris Coder - avatar