Using CSS with Grids/Tables

Discussion in 'ASP .Net' started by tshad, Jul 7, 2006.

  1. tshad

    tshad Guest

    I am trying to set up various grids with different displays and don't want
    to set each row and column individually.

    Right now I use the following in my css page:

    table {
    border-collapse: separate;
    border-color:#999999
    }
    th {
    background-color:#000000;
    color:white;
    text-decoration: none;
    border-style:none;
    vertical-align:bottom;
    font-size:14px;
    }
    td {
    empty-cells: show;
    text-align:left;
    }

    But this sets all the tables in the application the same.

    What I am trying to do is something like:

    standard.table
    standard.td
    standard.th
    customer.table
    customer.td
    customer.th
    client.table
    client.td
    client.th

    Is there a way to do something like this and just assign one of the 3 to a
    particular table using css?

    Thanks,

    Tom
    tshad, Jul 7, 2006
    #1
    1. Advertising

  2. tshad

    Guest

    you can combine css tags like this:

    ClassName element { style }

    so if your grid has a CssClassName of MyGrid:

    MyGrid th { font-family:tahoma }

    or even

    MyGrid th, MyOtherGrid th { some style }


    tshad wrote:
    > I am trying to set up various grids with different displays and don't want
    > to set each row and column individually.
    >
    > Right now I use the following in my css page:
    >
    > table {
    > border-collapse: separate;
    > border-color:#999999
    > }
    > th {
    > background-color:#000000;
    > color:white;
    > text-decoration: none;
    > border-style:none;
    > vertical-align:bottom;
    > font-size:14px;
    > }
    > td {
    > empty-cells: show;
    > text-align:left;
    > }
    >
    > But this sets all the tables in the application the same.
    >
    > What I am trying to do is something like:
    >
    > standard.table
    > standard.td
    > standard.th
    > customer.table
    > customer.td
    > customer.th
    > client.table
    > client.td
    > client.th
    >
    > Is there a way to do something like this and just assign one of the 3 to a
    > particular table using css?
    >
    > Thanks,
    >
    > Tom
    , Jul 7, 2006
    #2
    1. Advertising

  3. tshad

    tshad Guest

    Would each of the tags have to have a "." on them?

    For example:

    ..MyGrid table {border-color:#2f2f2f}
    ..MyGrid th { font-family:tahoma }
    ..MyGrid td {text-align:left}

    Then do something like:

    <asp:DataGrid CssClass="MyGrid" ...

    Thanks,

    Tom

    <> wrote in message
    news:...
    > you can combine css tags like this:
    >
    > ClassName element { style }
    >
    > so if your grid has a CssClassName of MyGrid:
    >
    > MyGrid th { font-family:tahoma }
    >
    > or even
    >
    > MyGrid th, MyOtherGrid th { some style }
    >
    >
    > tshad wrote:
    >> I am trying to set up various grids with different displays and don't
    >> want
    >> to set each row and column individually.
    >>
    >> Right now I use the following in my css page:
    >>
    >> table {
    >> border-collapse: separate;
    >> border-color:#999999
    >> }
    >> th {
    >> background-color:#000000;
    >> color:white;
    >> text-decoration: none;
    >> border-style:none;
    >> vertical-align:bottom;
    >> font-size:14px;
    >> }
    >> td {
    >> empty-cells: show;
    >> text-align:left;
    >> }
    >>
    >> But this sets all the tables in the application the same.
    >>
    >> What I am trying to do is something like:
    >>
    >> standard.table
    >> standard.td
    >> standard.th
    >> customer.table
    >> customer.td
    >> customer.th
    >> client.table
    >> client.td
    >> client.th
    >>
    >> Is there a way to do something like this and just assign one of the 3 to
    >> a
    >> particular table using css?
    >>
    >> Thanks,
    >>
    >> Tom

    >
    tshad, Jul 11, 2006
    #3
  4. tshad

    Guest

    not entirely sure what you mean...

    a css class when declared in css, needs a "." at the beginning, but not
    in the html tag itself

    <style>

    th {some style}

    ..SomeClass {some style}

    #anID {some style}

    </style>

    you can refer to the id of an element using #
    you can refer to the class of an element using .
    you can refer to an element using its tag

    in html would be like this:

    <th class="SomeClass" id="anID">


    tshad wrote:
    > Would each of the tags have to have a "." on them?
    >
    > For example:
    >
    > .MyGrid table {border-color:#2f2f2f}
    > .MyGrid th { font-family:tahoma }
    > .MyGrid td {text-align:left}
    >
    > Then do something like:
    >
    > <asp:DataGrid CssClass="MyGrid" ...
    >
    > Thanks,
    >
    > Tom
    >
    > <> wrote in message
    > news:...
    > > you can combine css tags like this:
    > >
    > > ClassName element { style }
    > >
    > > so if your grid has a CssClassName of MyGrid:
    > >
    > > MyGrid th { font-family:tahoma }
    > >
    > > or even
    > >
    > > MyGrid th, MyOtherGrid th { some style }
    > >
    > >
    > > tshad wrote:
    > >> I am trying to set up various grids with different displays and don't
    > >> want
    > >> to set each row and column individually.
    > >>
    > >> Right now I use the following in my css page:
    > >>
    > >> table {
    > >> border-collapse: separate;
    > >> border-color:#999999
    > >> }
    > >> th {
    > >> background-color:#000000;
    > >> color:white;
    > >> text-decoration: none;
    > >> border-style:none;
    > >> vertical-align:bottom;
    > >> font-size:14px;
    > >> }
    > >> td {
    > >> empty-cells: show;
    > >> text-align:left;
    > >> }
    > >>
    > >> But this sets all the tables in the application the same.
    > >>
    > >> What I am trying to do is something like:
    > >>
    > >> standard.table
    > >> standard.td
    > >> standard.th
    > >> customer.table
    > >> customer.td
    > >> customer.th
    > >> client.table
    > >> client.td
    > >> client.th
    > >>
    > >> Is there a way to do something like this and just assign one of the 3 to
    > >> a
    > >> particular table using css?
    > >>
    > >> Thanks,
    > >>
    > >> Tom

    > >
    , Jul 11, 2006
    #4
  5. tshad

    tshad Guest

    I am referring to your example.

    You have:

    MyGrid th...
    or
    MyGrid th, MyOtherGrid th

    There are no "."s there.

    Where would I set this in HTML, since as you said the statement would
    typically be:

    <th class="SomeClass" id="anID">

    where SomeClass would be ".SomeClass" in the css file.

    How would I use MyGrid in my HTML?

    I am would like to make all the <td><th><tr> different for different grids
    (MyGrid, MyOtherGrid).

    Thanks,

    Tom

    <> wrote in message
    news:...
    > not entirely sure what you mean...
    >
    > a css class when declared in css, needs a "." at the beginning, but not
    > in the html tag itself
    >
    > <style>
    >
    > th {some style}
    >
    > .SomeClass {some style}
    >
    > #anID {some style}
    >
    > </style>
    >
    > you can refer to the id of an element using #
    > you can refer to the class of an element using .
    > you can refer to an element using its tag
    >
    > in html would be like this:
    >
    > <th class="SomeClass" id="anID">
    >
    >
    > tshad wrote:
    >> Would each of the tags have to have a "." on them?
    >>
    >> For example:
    >>
    >> .MyGrid table {border-color:#2f2f2f}
    >> .MyGrid th { font-family:tahoma }
    >> .MyGrid td {text-align:left}
    >>
    >> Then do something like:
    >>
    >> <asp:DataGrid CssClass="MyGrid" ...
    >>
    >> Thanks,
    >>
    >> Tom
    >>
    >> <> wrote in message
    >> news:...
    >> > you can combine css tags like this:
    >> >
    >> > ClassName element { style }
    >> >
    >> > so if your grid has a CssClassName of MyGrid:
    >> >
    >> > MyGrid th { font-family:tahoma }
    >> >
    >> > or even
    >> >
    >> > MyGrid th, MyOtherGrid th { some style }
    >> >
    >> >
    >> > tshad wrote:
    >> >> I am trying to set up various grids with different displays and don't
    >> >> want
    >> >> to set each row and column individually.
    >> >>
    >> >> Right now I use the following in my css page:
    >> >>
    >> >> table {
    >> >> border-collapse: separate;
    >> >> border-color:#999999
    >> >> }
    >> >> th {
    >> >> background-color:#000000;
    >> >> color:white;
    >> >> text-decoration: none;
    >> >> border-style:none;
    >> >> vertical-align:bottom;
    >> >> font-size:14px;
    >> >> }
    >> >> td {
    >> >> empty-cells: show;
    >> >> text-align:left;
    >> >> }
    >> >>
    >> >> But this sets all the tables in the application the same.
    >> >>
    >> >> What I am trying to do is something like:
    >> >>
    >> >> standard.table
    >> >> standard.td
    >> >> standard.th
    >> >> customer.table
    >> >> customer.td
    >> >> customer.th
    >> >> client.table
    >> >> client.td
    >> >> client.th
    >> >>
    >> >> Is there a way to do something like this and just assign one of the 3
    >> >> to
    >> >> a
    >> >> particular table using css?
    >> >>
    >> >> Thanks,
    >> >>
    >> >> Tom
    >> >

    >
    tshad, Jul 20, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Barry

    Unbound tables or grids of data?

    Barry, Jul 23, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    330
    Barry
    Jul 23, 2003
  2. James G. Beldock

    Multiple grids - how to update layout position

    James G. Beldock, Jul 24, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    408
    Saravana
    Jul 24, 2003
  3. Replies:
    0
    Views:
    321
  4. Syed Hussain via DotNetMonster.com

    How to put multiple grids on tab strip control using asp.net

    Syed Hussain via DotNetMonster.com, Feb 9, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    522
    Syed Hussain via DotNetMonster.com
    Feb 9, 2005
  5. Tim Gee

    Grids / Tables

    Tim Gee, Mar 19, 2007, in forum: ASP General
    Replies:
    2
    Views:
    104
    Tim Gee
    Mar 19, 2007
Loading...

Share This Page