?
Solved

align 2 spans in div horizontally

Posted on 2011-09-20
4
Medium Priority
?
270 Views
Last Modified: 2012-05-12
Hello All,

IS there a way I can align two spans with   in between in a div to align horizontally

Thank you.
0
Comment
Question by:dojjol
[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
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
Gurvinder Pal Singh earned 2000 total points
ID: 36568762
<div>
  <span style="padding-right:2px;">column1</span>
  <span>column2</span>
</div>
0
 

Author Comment

by:dojjol
ID: 36568921
Thanks gurvinder372. It worked.

But if I enhance the situation like:

In a div I have 4 spans, in which two spans should be aligned horizontally and two vertically, this fails like

<div>
  <span style="padding-right:2px;">column1</span>
  <span>column2</span>
  <span style="padding-right:2px;">column3</span>
  <span>column4</span>
</div>

Can it be possible to have column 3 display under coulmn 1 and coulmn 4 under coulmn 2.

Thanks and appreciated

0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 36568929
add a <br> after second column
0
 
LVL 13

Expert Comment

by:Andrew Derse
ID: 36568973
Yes I would change it like this:

<div>
  <span style="padding-right:2px;">column1</span>
  <span>column2</span><br />
  <span style="padding-right:2px;">column3</span>
  <span>column4</span>
</div>

The spans will keep appending to the "row" that they are in.  Once you insert a <br /> then it will start a new "row" for you to put more <span>'s in.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
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…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
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 …
Suggested Courses

777 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