What Is The Alternative To
If I Want To Control The Height Between ...
Có thể bạn quan tâm
-
- Home
- Questions
- Tags
- Users
- Companies
- Labs
- Jobs
- Discussions
- Collectives
-
Communities for your favorite technologies. Explore all Collectives
- Teams
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Try Teams for free Explore Teams - Teams
-
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about CollectivesTeams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about TeamsGet early access and see previews of new features.
Learn more about Labs What is the alternative to <br /> if I want to control the height between lines? Ask Question Asked 12 years, 5 months ago Modified 2 years, 9 months ago Viewed 112k times 30In following example:
Line1 <br /> Line2I'm using <br /> to force Line2 to go to next line, but as far as I know there is no cross browser friendly way of setting the height of br. What is an alternative method I could use?
Share Improve this question Follow edited Jun 12, 2012 at 12:01 James Allardice 166k22 gold badges334 silver badges315 bronze badges asked Jun 12, 2012 at 12:00 DavidWDavidW 5,11914 gold badges47 silver badges70 bronze badges 5- 1 why did u exclude to wrap the text in several <p /> elements? – Kralizek Commented Jun 12, 2012 at 12:03
- "there is no cross browser friendly way of setting the height of br" That's because <br> doesn't have any height. It's just a command to create a new line. – Cthulhu Commented Jun 12, 2012 at 12:05
- Use padding, margins or line height. – SVS Commented Jun 12, 2012 at 12:05
- 1 are the Line1, Line 2 etc connected? You might be better with a <ul> & <li> tag if there is a semantic link between the Lines – atmd Commented Jun 12, 2012 at 12:06
- most answers are correct, it depends on the context of the question – Stuart Commented Jun 12, 2012 at 12:07
7 Answers
Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 30Use differents blocks :
<p>Line1</p> <p>Line2</p> Share Improve this answer Follow answered Jun 12, 2012 at 12:03 GuillaumeSGuillaumeS 1,6781 gold badge15 silver badges15 bronze badges Add a comment | 11Normally, using <br /> is old way of breaking a line. You should use <p>, <div> or some block level elements and give them top or bottom margins.
p { margin-top:5px; margin-bottom:5px } Share Improve this answer Follow answered Jun 12, 2012 at 12:04 AshwinAshwin 12.4k22 gold badges84 silver badges119 bronze badges Add a comment | 5Using CSS you can control the line-height property of any element.
someElement { line-height:12px; }Now you may simply set this for an element, or use it on the entire HTML to provide uniformity across the document. This is safe, cross-browser compatible and easy to use.
Share Improve this answer Follow edited Jun 12, 2012 at 12:11 thirtydot 228k49 gold badges392 silver badges353 bronze badges answered Jun 12, 2012 at 12:01 DigitalisDigitalis 5702 silver badges12 bronze badges 0 Add a comment | 3You can use css line-height property along with <br/> tag to control spacing between lines.
<style> .small { line-height:100px; } </style> <p class="small"> This is a paragraph with a smaller line-height.<br /> This is a paragraph with a smaller line-height.<br /> This is a paragraph with a smaller line-height.<br /> This is a paragraph with a smaller line-height.<br /> </p> Share Improve this answer Follow answered Jun 12, 2012 at 12:06 Ravi JainRavi Jain 1,4822 gold badges17 silver badges41 bronze badges Add a comment | 2- I add a <div>, best way for me, with CSS margin. Or,
- The <p> tag.
Use padding & / or margin css attributes.
Share Improve this answer Follow answered Jun 12, 2012 at 12:02 yogiyogi 19.5k13 gold badges64 silver badges93 bronze badges Add a comment | 0You can add a <div> like this
<div style="height: [put your height here]; display: block;"></div>Seems to work for me, as shown here:
<span>This is the previous line!</span> <div style="height: 50px; display: block;"></div> <span>This will be 50 pixels below the previous line.</span>
You can even use a span! <span>This is the previous line!</span> <span style="height: 50px; display: block;"></span> <span>This will be 50 pixels below the previous line.</span>
Share Improve this answer Follow edited Aug 22, 2021 at 21:39 answered Aug 22, 2021 at 21:32 Missing UserMissing User 1117 bronze badges Add a comment |Your Answer
Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Draft saved Draft discardedSign up or log in
Sign up using Google Sign up using Email and Password SubmitPost as a guest
Name EmailRequired, but never shown
Post Your Answer DiscardBy clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Not the answer you're looking for? Browse other questions tagged
or ask your own question.- The Overflow Blog
- We'll Be In Touch - A New Podcast From Stack Overflow!
- The app that fights for your data privacy rights
- Featured on Meta
- More network sites to see advertising test
- We’re (finally!) going to the cloud!
- Call for testers for an early access release of a Stack Overflow extension...
Linked
-5 Alternative of using <br> in several lines 6 Cursor in contenteditable not behaving properly in Chrome 0 Another way of line break through css without using br?Related
23 Make new line without using <br> in HTML 4 How to set the space between lines in a div without setting line height 0 HTML:Adjust height between br element 5 Controlling the line-height of a <br> tag within a heading tag? 0 Why the <br> element has more height than line-height 7 How to adjust the amount of space between two lines at each <br> in CSS? 2 HTML/CSS -lineheight is affecting <br> tag? 1 how do you shorten a breaks line height in html? 0 How to use 'line-height' without increasing size of <span> 1 Control the space the <br> tag gives html/cssHot Network Questions
- Georeference the second and the following pages of PDF in QGIS
- Indoor 10 feet tall avocado tree I tall needs to be cut
- What is the best language to speak with locals in Singapore?
- In Catholic atonement theology, if God can save Mary from all sin without Christ, what was the point of Christ's death?
- Which is larger? 999,999! or 2^(11!)
- Is it legal to take advantage of loopholes in GAAP to misrepresent profit?
- What are the reasons to use a downward vertical stabilizer?
- US jurisdictions
- How were lead sheets made in the Graeco-Roman world?
- A PicoBlaze assembly program that converts binary numbers to octal
- Is vertex mass the mass of the whole object?
- How far above a forest fire or conflagration would you need to be, to not burn alive?
- Is it allowed to use web APIs exposed in open-source code?
- Girls and boys parades
- Prevent same name overwrite with robocopy
- Are there three distinct Pythagorean triples on six integers?
- How to generate N-dimensional multivariate-normal sample from N-2 marginals
- Does a premise based on subjectivity compromise a logical argument seeking to conclude with an objective conclusion/claim?
- How complex is the God of Classical Theism?
- Calculate the number of ways to arrange the letters in the word "freezer" without having any adjacent (double) letters
- When SG-1 arrives in 1969, why is it initially an "empty" gate room?
- A linked list in C, as generic and modular as possible, for my personal util library
- Continuum-distanced complete, ultrametric space
- Does Windows 11 Pin Behavior Break Password Security Conventions?
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
lang-htmlTừ khóa » Html Br Substitute
-
What Is The Best Alternative To Repetitive Typing Of
Tags In HTML ... -
Alternative To BR TAG | Learn HTML CSS - YouTube
-
How To Break Line Without Using
Tag In HTML / CSS -
What To Use Instead Of
- HTML Forum At WebmasterWorld -
How To Break Line Without Using
Tag In CSS - W3docs -
How To Replace Line Break Tags (
) With Spaces In CSS | TimOnWeb -
Substitution Tags | Twilio - SendGrid Documentation
-
Alternative To
Inside- - HTML & CSS - SitePoint Forums
-
Mod_substitute - Apache HTTP Server Version 2.5
-
Nucleophilic Substitution - Halogenoalkanes And Hydroxide Ions
-
Nucleophilic Substitution - Halogenoalkanes And Cyanide Ions
-
Effects Of Halogen Substitution On The Optoelectronic Properties Of ...
-
Using The Br Tag - Line Break Tag