Solved

Different text alignment on same line via CSS

Posted on 2012-04-13
2
573 Views
Last Modified: 2012-04-13
I am trying to display text on the same line that has 2 different types of alignment (see image below).  I want to display a word that is displayed in the center of the page and on the same line display a word that is right aligned.  Is this possible to do?  If so what is the style that I would use?

Example of desired text display
0
Comment
Question by:WestCoast_BC
2 Comments
 
LVL 9

Accepted Solution

by:
Aeriden earned 500 total points
Comment Utility
This is what I do, CSS-wise (adjust the margin-bottom value based on the text size and other layout):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>Test Page</title>
<style type="text/css">
div.style1 { text-align: center; margin-bottom: -20px}
div.style2 { text-align: right; }
</style>
</head>

<body>
<div class="style1">center</div><div class="style2">right</div>

</body>

</html>
0
 

Author Comment

by:WestCoast_BC
Comment Utility
Thanks, this works.  I was doing what you suggested except I was missing the margin-bottom part.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
extra space below iframe 9 51
Website like ebay or amazon 3 56
erros on link  checking 2 42
SP to delete duplicates 15 54
Problem to be resolved in this article Currently, development of website and web application can be done without writing thousands of lines of programming code by hand. Description This can be done through by using a open source framework such …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

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

14 Experts available now in Live!

Get 1:1 Help Now