CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
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 April 30th, 2003, 10:42 PM
vb.net vb.net is offline
Demonic Swordsman DGQB
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Posts: 995 vb.net User rank is Second Lieutenant (5000 - 10000 Reputation Level)vb.net User rank is Second Lieutenant (5000 - 10000 Reputation Level)vb.net User rank is Second Lieutenant (5000 - 10000 Reputation Level)vb.net User rank is Second Lieutenant (5000 - 10000 Reputation Level)vb.net User rank is Second Lieutenant (5000 - 10000 Reputation Level)vb.net User rank is Second Lieutenant (5000 - 10000 Reputation Level)vb.net User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Days 12 h 38 m 28 sec
Reputation Power: 76
a few questions about CSS

1. what's the equavelent of align="center" in CSS? The only thing I have noticed is text-align, but that doesn't help when I want to center a table. P.S. I must say no to deprecated tags like <center>

2. I want to include 2 classes in an element, such as td class="td" class="td1", but of course only one can be included normally. Is there a way to use both?

Thanks.

Reply With Quote
  #2  
Old May 1st, 2003, 07:53 AM
binky's Avatar
binky binky is offline
Gerbil
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Oct 2001
Location: In a Rotastak
Posts: 1,763 binky User rank is Sergeant (500 - 2000 Reputation Level)binky User rank is Sergeant (500 - 2000 Reputation Level)binky User rank is Sergeant (500 - 2000 Reputation Level)binky User rank is Sergeant (500 - 2000 Reputation Level)binky User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 22 h 12 m 52 sec
Reputation Power: 18
text-align does work:

<p style='text-align:center'>
<table style='width:90%; background-color:yellow;'>
<tr><td style='text-align:center;'>Hello!</td></tr>
</table>
</p>

should hopefully prove that.
__________________
- Sorted!

www.ppfuk.com - Free Photo Sharing

Reply With Quote
  #3  
Old May 1st, 2003, 09:15 AM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,299 jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 2 Days 1 h 54 m 17 sec
Reputation Power: 760
Not sure if you're going for some sort of standards compliance, but I don't think putting a <table> inside a <p> will validate as XHTML. Don't know if it matters, but if it does, I'll offer another solution.
Code:
<style type="text/css">
.centered
  {
  width: 50%;
  margin-left: auto;
  margin-right: auto;
  }
</style>

<table class="centered">
  <tr>
    <td>Something</td>
  </tr>
</table>
As for two classes on one element, no can do. But you can use an ID and a class in combination with each other, and if you look over where you have the two classes, you'll probably find that makes more sense logically.

Reply With Quote
  #4  
Old May 1st, 2003, 09:40 AM
adios adios is offline
Senior Citizen
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2001
Location: leftcoast
Posts: 2,019 adios User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 10

Reply With Quote
  #5  
Old May 1st, 2003, 12:43 PM
vb.net vb.net is offline
Demonic Swordsman DGQB
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Posts: 995 vb.net User rank is Second Lieutenant (5000 - 10000 Reputation Level)vb.net User rank is Second Lieutenant (5000 - 10000 Reputation Level)vb.net User rank is Second Lieutenant (5000 - 10000 Reputation Level)vb.net User rank is Second Lieutenant (5000 - 10000 Reputation Level)vb.net User rank is Second Lieutenant (5000 - 10000 Reputation Level)vb.net User rank is Second Lieutenant (5000 - 10000 Reputation Level)vb.net User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Days 12 h 38 m 28 sec
Reputation Power: 76
thank you all.

for the first problem, I've settled with <div class="center">, which seems to work, and special thanks to adios for the link.

Reply With Quote
  #6  
Old May 1st, 2003, 01:21 PM
vb.net vb.net is offline
Demonic Swordsman DGQB
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Posts: 995 vb.net User rank is Second Lieutenant (5000 - 10000 Reputation Level)vb.net User rank is Second Lieutenant (5000 - 10000 Reputation Level)vb.net User rank is Second Lieutenant (5000 - 10000 Reputation Level)vb.net User rank is Second Lieutenant (5000 - 10000 Reputation Level)vb.net User rank is Second Lieutenant (5000 - 10000 Reputation Level)vb.net User rank is Second Lieutenant (5000 - 10000 Reputation Level)vb.net User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Days 12 h 38 m 28 sec
Reputation Power: 76
Okay, it turned out things were not so simple. Apparently, the <div class="center"> works fine with IE, but Netscape will not do. On the other hand, the solution jharnois presented will ONLY work with Netscape, not with IE. Ahh, the frustration of customized browsers support.

Reply With Quote
  #7  
Old May 1st, 2003, 03:32 PM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,299 jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 2 Days 1 h 54 m 17 sec
Reputation Power: 760
I think for what I suggested you have to have the container's style have text-align:center. So if you're centering a table inside the body, apply text-align:center to the body. If it's a nested table inside a div, apply it to the div. All of that in addition to what I already posted.

Reply With Quote
  #8  
Old May 1st, 2003, 07:43 PM
jkd jkd is offline
CF sMod
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Location: Maine, USA (a.k.a. Boonies)
Posts: 242 jkd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 43 sec
Reputation Power: 9
Send a message via ICQ to jkd Send a message via AIM to jkd Send a message via Yahoo to jkd
Notice that the property is text-align? Yes. Text. Inline elements. Not block-level elements.

The correct way of centering blocks is:
margin-left: auto;
margin-right: auto;

Or if you know you won't have any top/bottom margins, you can just say:
margin: 0 auto;

The fact that IE aligns blocks with text-align is a known bug - please don't perpetuate it's usage.
__________________
Jason Contact Me
Super moderator @ CodingForums

Reply With Quote
  #9  
Old May 2nd, 2003, 06:37 AM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,299 jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 2 Days 1 h 54 m 17 sec
Reputation Power: 760
Yes, while using text-align to align a block-level element is technically incorrect, there are serveral known bugs that require the use of some kind of workaround, and that is the workaround for the problem stated.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > a few questions about CSS


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway