Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > CSS > CSS Cascading Style Sheets
|
CSS Cascading Style Sheets All issues relating to Cascading Style Sheets (CSS).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the CSS Cascading Style Sheets section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 11th, 2006, 09:38 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default how to have both right and left aligned text in td

anyone know any nice (or ugly ;)) hacks for this. This is in the context of mandatory field indicators on data entry forms laid out as tables (sometimes form-style and sometimes table style). What I want is the label text left-aligned and the * right-aligned within a single td or th.

______________________________
| label * | input |
------------------------------

or

______________________________________________
| label * | label * | label * |
|---------------------------------------------
| input | input | input |
----------------------------------------------

tia
phil
 
Old July 12th, 2006, 09:07 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

You'd have to do it like this:

<td>
    <span>*</span>
    <label>Label text</label>
</td>

Put the <span> before the <label>, then in the style sheet, something like this:

td span {
    float: right;
}

That'll put the asterisk right aligned on the same line as the label.

HTH!

Regards,
Rich

--
Author,
Beginning CSS: Cascading Style Sheets For Web Design
CSS Instant Results

http://www.catb.org/~esr/faqs/smart-questions.html
 
Old July 13th, 2006, 08:51 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

brilliant, thanks Richard, this has been annoying me for weeks now.





Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML DOM - clone form element could not be aligned Shibu Javascript 5 November 15th, 2008 11:24 PM
LEFT vs LEFT OUTER joxa83 SQL Server 2005 3 September 18th, 2008 03:13 AM
CSS for fixed width li and right aligned text echovue CSS Cascading Style Sheets 2 March 12th, 2007 02:21 PM
text wrapping and controls clinging to left of pag cathiec Visual Studio 2005 0 August 10th, 2005 11:19 AM
td abbr crmpicco HTML Code Clinic 6 June 14th, 2005 08:27 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.