boxturt Posted August 7, 2003 Posted August 7, 2003 Is there any way to prevent the line breaks after a set of <h1></h1> tags? I'd like to use the tag but it makes the page look, well, kinda crappy. Quote
borfast Posted August 7, 2003 Posted August 7, 2003 Actually, even CSS masters recommend you use <h1> tags, Jim Among other things, it allows your webpage to be correctly displayed even on browsers that have different stylesheets set up to override the ones you specify on your webpage. Or even browsers that don't make use of stylesheets at all but know how to interpret XHTML tags. Or vocal-browsers, for blind people. Or... OK, you get the point As for your question, boxturt, you can prevent the line break after the <h1> tag if you use CSS to set it's display style to inline. Something like this should do the trick: ><h1 style="display: inline;" >Inside H1</h1>Outside H1 The "Outside H1" text should appear right next to the "Inside H1" text. If you take out the "style=....." stuff, leaving only ><h1>Inside H1</h1>Outside H1 you will indeed have a line break. That's because the H1 element is a block level element instead of an inline element, which means that it has an implicit line break right after it. If it was an inline element, it would not have a line break after it, like the <a href=.....> tags. So what you do is use CSS to make it an inline element, effectively turning off the line break Quote
boxturt Posted August 7, 2003 Author Posted August 7, 2003 Oh yeaaaaaaa! Thank you very much That very much does the trick. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.