?
Solved

how to apply line break <br> in href tag

Posted on 2013-11-23
10
Medium Priority
?
277 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 58

Assisted Solution

by:Gary
Gary earned 400 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

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 1600 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
 
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 1600 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

771 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