Forcing headings to wrap in html
Asked Answered
I

5

22

I have a web page that displays a pdf document. In the header there is an image and an h1 tag that contains a name. When the name is too long, it gets cut off. How can I force it to wrap to the next line instead so that the entire name is displayed? I tried inserting a style="white-space:normal" but it doesn't help. Any suggestions?

Initiative answered 16/12, 2009 at 19:53 Comment(1)
Can you post some example code that we look at to get a better idea of the problem?Cabernet
R
26
word-wrap:break-word;
Roebuck answered 16/12, 2009 at 19:55 Comment(1)
make sure it is also white-space:normalGilbertegilbertian
A
17

It should have the combination of two:

word-wrap: break-word;
white-space: normal;

thanks to Tor and Alex :)

Anyway answered 10/1, 2019 at 10:6 Comment(0)
N
8

h1 tags wrap by default. If they're not, something in your CSS is overriding that default behaviour. If you can post a link to the site, we can quickly help you out. You might want to consider installing Firebug for Firefox - it'll let you right-click on the h1 and view what styles are being applied to it, and from where they come.

Neurilemma answered 16/12, 2009 at 20:8 Comment(0)
D
1

Is the header contained wihtin another element such as a div? If so, check the overflow for that element and/or try setting it to visible like this:

style="overflow:visible;"
Duran answered 16/12, 2009 at 19:55 Comment(1)
No, it's not within another elementInitiative
P
1

the h1 tag has a zero line height

style="line-height:100%;"
Phippen answered 7/11, 2018 at 8:51 Comment(1)
This does not answer the question at all. It is not even related to the question.Eggnog

© 2022 - 2024 — McMap. All rights reserved.