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
Solved

how to apply line break <br> in href tag

Posted on 2013-11-23
10
273 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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
Dynamic Dropdowns 15 32
jQuery Dialog Autoresize Bug 2 24
What if i make webbased alternative for MS Access 5 67
Ouput in html in powershell 2 17
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.
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

792 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