HighDots Forums  

CSS and tables.

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss CSS and tables. in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
takigama@gmail.com
 
Posts: n/a

Default CSS and tables. - 08-10-2006 , 02:32 AM






Hi all,

Im relatively new to css, i've used it for very generic stuff, but not
to the extent im using it in my current project. the question i have is
this.

Why doesnt this do what i thought it would:

css
-----
..pos_table {
border: 0px #ffffff solid
}

A.pos_table:link,A.pos_table:active,A.pos_table:vi sited {
font-size: 23px;
}

A.pos_table:hover {
font-size: 23px;
}

TH.pos_table {
font-size: 23px
}
-----

html
------
<div class="pos_table">
<table><tr><th>my header</th></tr><tr><td><a
href="somelink>text</a></table>
</div>

------

i was expecting that the TH.pos_table would make "my header" font size
23... but it doesnt, it reverts to what i've define TH do be, not
TH.pos_table. Instead, i find i have to:

....<th class="pos_table">...</th>

The same case with the href.. i.e. <a class="pos_table"....>

Why? or is this just a case of "your an idiot, you dont define it like
that in the first place anyway". It seems needlessly wastefull to have
to define which class everything inside the div is? What obviously
invalid assumptions have i made about how css works?


Reply With Quote
  #2  
Old   
Christian Kirsch
 
Posts: n/a

Default Re: CSS and tables. - 08-10-2006 , 03:48 AM






takigama (AT) gmail (DOT) com schrieb:
Quote:
Hi all,

Im relatively new to css, i've used it for very generic stuff, but not
to the extent im using it in my current project. the question i have is
this.

Why doesnt this do what i thought it would:

css
-----
.pos_table {
border: 0px #ffffff solid
}

A.pos_table:link,A.pos_table:active,A.pos_table:vi sited {
font-size: 23px;
}
The regulars in this group seem to consider font-size specifications
in pixels BAD. They prefer em or percent sizes.

Quote:
A.pos_table:hover {
font-size: 23px;
}

TH.pos_table {
font-size: 23px
}
-----

html
------
div class="pos_table"
table><tr><th>my header</th></tr><tr><td><a
href="somelink>text</a></table
/div

------

i was expecting that the TH.pos_table would make "my header" font size
23... but it doesnt, it reverts to what i've define TH do be, not
TH.pos_table. Instead, i find i have to:

...<th class="pos_table">...</th

The same case with the href.. i.e. <a class="pos_table"....

Why? or is this just a case of "your an idiot, you dont define it like
that in the first place anyway". It seems needlessly wastefull to have
to define which class everything inside the div is? What obviously
invalid assumptions have i made about how css works?

TH is a child of an element whose class is 'pos_table' (namely the
DIV). What you specified in your class selectors are elements of class
'pos_table', whose *parent* is either a link (A) or a table header
(TH). You might want to check your CSS documentation, in particular
the different selectors.

In addition, in CSS not all attributes are propagated to descendants.
Notably, border styles never propagate. In addition, certain browsers
seem(ed?) to have problems applying font attributes defined for the
enclosing element to a table.


Reply With Quote
  #3  
Old   
David Dorward
 
Posts: n/a

Default Re: CSS and tables. - 08-10-2006 , 03:56 AM



takigama (AT) gmail (DOT) com wrote:
Quote:
TH.pos_table {
font-size: 23px
Avoid pixels for font size.
http://css-discuss.incutio.com/?page=UsingPixels

Quote:
div class="pos_table"
table><tr><th>my header</th></tr><tr><td><a

i was expecting that the TH.pos_table would make "my header" font size
23... but it doesnt, it reverts to what i've define TH do be, not
TH.pos_table.
The th element is not a member of the pos_table class, it is a
descendent of such a member.

You want to use a descendent selector.
http://www.w3.org/TR/CSS2/selector.h...dant-selectors



Reply With Quote
  #4  
Old   
Andy Dingley
 
Posts: n/a

Default Re: CSS and tables. - 08-10-2006 , 05:56 AM




takigama (AT) gmail (DOT) com wrote:

Quote:
Why doesnt this do what i thought it would:

TH.pos_table {

div class="pos_table"
table><tr><th>my header</th></tr><tr><td><a
You applied the class (quite rightly) to a container around the table.
You might possibly have been able to skip that <div> and just use
<table class="pos_table" >

For a CSS selector try this

.pos_table th { ... }

Note that .pos_table th, th.pos_table and th .pos_table are all quite
different CSS selectors.


PS - Don't use font sizing in pixels.

Don't apply font sizing to inline elements (you can do this, but it's
really unusual to need to modify this - just let the settings inherit).

Don't set font-size, font-weight or a few other settings from an :hover
{} rule. It makes for links that jump around when you hover over them.



Reply With Quote
  #5  
Old   
Nije Nego
 
Posts: n/a

Default Re: CSS and tables. - 08-10-2006 , 01:31 PM



On 10 Aug 2006 00:32:01 -0700, takigama (AT) gmail (DOT) com wrote:

The question:
Quote:
Why doesnt this do what i thought it would:
is being repeated endesly eversince.

--
buy, bought, bye


Reply With Quote
Reply




Thread Tools
Display Modes

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.