Solved

Different text alignment on same line via CSS

Posted on 2012-04-13
2
608 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
ID: 37844565
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
ID: 37844626
Thanks, this works.  I was doing what you suggested except I was missing the margin-bottom part.
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
One field not displaying content (ASP Classic) 8 29
Connection to multiple databases 13 25
Syntax for query to update table 2 29
Domain Service Not Responding 14 30
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
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.
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 purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…

837 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