CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 12th, 2012, 12:48 PM
frameexpert frameexpert is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 2 frameexpert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 27 m 34 sec
Reputation Power: 0
Horizontal spacing

Hi,

I have a tight set of paragraphs like this:

<p>PASSED: 18,230</p>
<p>LEFT: 7,300</p>
<p>CHRISTMASES: 20</p>

I need to left-align the "labels" and right-align the numbers. The horizontal layout is tight:

Code:
PASSED:  18,200
LEFT:     7,300
CHRISTMASES: 20

which means that the long label will encroach on the numbers above. I don't know if a table will allow this. Any suggestions on how to do this with CSS would be appreciated.

Note that I can structure the HTML any way I want, so I don't need to use <p> elements like in my example. Thanks in advance.

Rick

Reply With Quote
  #2  
Old November 12th, 2012, 10:08 PM
frameexpert frameexpert is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 2 frameexpert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 27 m 34 sec
Reputation Power: 0
Here is what I have so far:

Code:
<html>
  <head>
    <title>Number Our Days</title>
    <link rel="stylesheet" type="text/css" href="test.css" />
  </head>
  <body>
    <h1>Number Our Days</h1>
    <p class="label">PASSED:</p>
    <p class="number">18,200</p>
    <p class="label">LEFT:</p>
    <p class="number">7,300</p>
    <p class="label">CHRISTMASES:</p>
    <p class="number">20</p>
  </body>
</html>


Code:
* {
    margin:0; padding: 0;
}

body {
    width: 130px;
    font-family:  Calibri;
    overflow: hidden;
}

p {
    padding-left: 4px;
    padding-right: 4px;
    padding-top: 2px;
    padding-bottom: 2px;
    width: 122px;
}

p.label {
    font-size:  12px;
    text-align: left;

}

p.number {
    font-size: 22px;
    text-align: right;
    margin-top: -26px;
}

h1 {
    width: 122px;
    font-weight: bold;
    color: Navy;
    font-size: 14px;
    text-align: center;
    padding: 4px;
}


This actually works pretty well. This is going to be for a Windows gadget, so it needs to be pretty tight. Any other suggestions are welcome. Thank you very much.

Reply With Quote
  #3  
Old November 13th, 2012, 02:14 AM
simplypixie simplypixie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2012
Posts: 104 simplypixie User rank is Sergeant (500 - 2000 Reputation Level)simplypixie User rank is Sergeant (500 - 2000 Reputation Level)simplypixie User rank is Sergeant (500 - 2000 Reputation Level)simplypixie User rank is Sergeant (500 - 2000 Reputation Level)simplypixie User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 18 h 33 m 57 sec
Reputation Power: 11
By using floats and widths:

Code:
<html>
  <head>
    <title>Number Our Days</title>
    <link rel="stylesheet" type="text/css" href="test.css" />
  </head>
  <body>
    <h1>Number Our Days</h1>
    <p><span class="label">PASSED:</span>18,200</p>
    <p><span class="label">LEFT:</span>7,300</p>
    <p><span class="label">CHRISTMASES:</span>20</p>
  </body>
</html>


In your CSS
Code:
.label {
  float: left;
  width: 140px;
}


You will need to adjust the width to suit your needs

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > Horizontal spacing

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap