Solved

how to apply line break <br> in href tag

Posted on 2013-11-23
10
269 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
Comment Utility
<a href ="hello_world">hello<br>world</a>
0
 

Author Comment

by:Rocking
Comment Utility
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
Comment Utility
I need to see it in context to understand what you mean.  You can add more <br> tags
0
 

Author Comment

by:Rocking
Comment Utility
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 42

Accepted Solution

by:
Chris Stanyon earned 400 total points
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 53

Expert Comment

by:COBOLdinosaur
Comment Utility
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
Comment Utility
@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 42

Assisted Solution

by:Chris Stanyon
Chris Stanyon earned 400 total points
Comment Utility
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
Comment Utility
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
Comment Utility
this was exactly as per my requirement
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
This video teaches users how to migrate an existing Wordpress website to a new domain.

772 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

10 Experts available now in Live!

Get 1:1 Help Now