Solved

how to apply line break <br> in href tag

Posted on 2013-11-23
10
270 Views
Last Modified: 2013-11-25
Hi,

I need to display hello world in the format
hello
world.

I am using <a href ="hello_world"> hello world </a>

I have to use only single href ? is here any way on which i can achieve this?
0
Comment
Question by:Rocking
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 58

Assisted Solution

by:Gary
Gary earned 100 total points
ID: 39671657
<a href ="hello_world">hello<br>world</a>
0
 

Author Comment

by:Rocking
ID: 39671669
with this i can achieve the required output is there any other way also? since in the div i am using it flows down far beyond (ex displayed ) expected may be need to change the div or somewhere since the screen design is complex i am searching for another workaround?

hello





world
0
 
LVL 58

Expert Comment

by:Gary
ID: 39671680
I need to see it in context to understand what you mean.  You can add more <br> tags
0
 

Author Comment

by:Rocking
ID: 39671694
No what i mean to say is when i apply the <br> tag the link looks like thsi
hello



world

but the expected output i need is
hello
world


there may be the issue of div in which it is wrapped or other way round,since there are a lots of css are used and screen design is quite complex,i need to know is there any workaround other than applying the
<a href ="hello_world">hello<br>world</a> to achieve the output
0
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 400 total points
ID: 39671809
If you're getting that gap, then it's probably down to your line-height (either explicitly set or inherited). If that's the case, then no matter how you break the line, you'll get the gap.

The only way to not get the gap is to override the line-height:

<a href ="hello_world" style="line-height:1em;">hello<br/>world</a> 

Open in new window

(You may need to set the line-height for the parent element, or change the display type of your A tag)
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 39671990
All we are going to get here is speculation until you post a link so we can see context.  An answer might  come from a lucky guess, and guessing is about all you are going to get with the information you have provided.

Cd&
0
 

Author Comment

by:Rocking
ID: 39672815
@ChrisStanyon

if i put this code in a plain html the output is
<a href ="hello_world" style="line-height:1em;">hello<br/>world</a>

hello </br> world
0
 
LVL 43

Assisted Solution

by:Chris Stanyon
Chris Stanyon earned 400 total points
ID: 39672825
Then you're doing something wrong.

This is HTML 101 - it really doesn't get any easier :)

Have a look at this:

http://jsfiddle.net/ChrisStanyon/wjx7D/
0
 
LVL 58

Expert Comment

by:Gary
ID: 39672833
Is this exactly what you get
hello </br> world

If it is then you are not telling us the whole story.
0
 

Author Closing Comment

by:Rocking
ID: 39672847
this was exactly as per my requirement
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now