Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Different text alignment on same line via CSS

Posted on 2012-04-13
2
Medium Priority
?
622 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
[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 Comments
 
LVL 9

Accepted Solution

by:
Aeriden earned 2000 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

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses

715 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