Solved

how to apply line break <br> in href tag

Posted on 2013-11-23
10
274 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HTML5 storage and web apps 11 50
Hide and Unhide Table 6 26
Put POST values into cookies. 14 34
sort Multi-dimensional array 6 13
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
This article discusses how to implement server side field validation and display customized error messages to the client.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn how to count occurrences of each item in an array.

733 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