class with table problem

F

Frank

Hi, I have the next classes in a .css file:

..tabelgeenborder {
table {border: 0}
td {border:0}
}
..vebrotabel {
table {border: 1px solid red;border-collapse:collapse}
td {border: 1px solid red}
}

Only the second definition is recognized. If I use tabelgeenborder nothing
happens. Is this a bug or am I doing something wrong?

Thanx

Frank
 
S

Steve Pugh

Frank said:
Hi, I have the next classes in a .css file:

.tabelgeenborder {
table {border: 0}
td {border:0}
}
.vebrotabel {
table {border: 1px solid red;border-collapse:collapse}
td {border: 1px solid red}
}

Only the second definition is recognized. If I use tabelgeenborder nothing
happens. Is this a bug or am I doing something wrong?

They're both wrong. What's the HTMl you're trying to match. If it's
something like
<div class="tabelgeenborder"><table>
then the CSS selector is
..tabelgeenborder table { ...styles... }

Steve
 
S

Sid Ismail

: Hi, I have the next classes in a .css file:
:
: .tabelgeenborder {
: table {border: 0}
: td {border:0}
: }
: .vebrotabel {
: table {border: 1px solid red;border-collapse:collapse}
: td {border: 1px solid red}
: }


Try:

..tabelgeenborder {border:0;}
..verbrotabel {border: 1px solid red;border-collapse:collapse}

And

<table class=tabelgeenborder>
<tr>
 
F

Frank

Frank said:
Hi, I have the next classes in a .css file:

.tabelgeenborder {
table {border: 0}
td {border:0}
}
.vebrotabel {
table {border: 1px solid red;border-collapse:collapse}
td {border: 1px solid red}
}

Only the second definition is recognized. If I use tabelgeenborder nothing
happens. Is this a bug or am I doing something wrong?

Thanx

Frank
Rob and Sid, It doesn't make a difference how I do it, it does not work.
Example below. Notice that I used 2 tables with div and two with class= in
the <table>.
I want a definition for a table with border and one without. Strangest is
that if you switch the classes in place in the <style> the outcome is
totally different! How can that be!!

Regards
Frank

<style TYPE="text/css" MEDIA=screen>
..tabnoborder table{border: 0}
td {border: 0}
..tabwithborder table{border: 1px solid red}
td {border: 1px solid red}
</style>
<div class="tabwithborder">
<table>
<tr> <td>wdshgkdjfh gkjhgfkjhfgskjfh</td>
<td>kjhv khgf hgfgh</td>
</tr>
<tr> <td>wdshgkdjfh gkjhgfkjhfgskjfh</td>
<td>kjhv khgf hgfgh</td>
</tr>
</table></div>
<div class="tabnoborder"><br>
<table>
<tr> <td>wdshgkdjfh gkjhgfkjhfgskjfh</td>
<td>kjhv khgf hgfgh</td>
</tr>
<tr> <td>wdshgkdjfh gkjhgfkjhfgskjfh</td>
<td>kjhv khgf hgfgh</td>
</tr>
</table></div><br>
<table class="tabwithborder">
<tr> <td>wdshgkdjfh gkjhgfkjhfgskjfh</td>
<td>kjhv khgf hgfgh</td>
</tr>
<tr> <td>wdshgkdjfh gkjhgfkjhfgskjfh</td>
<td>kjhv khgf hgfgh</td>
</tr>
</table><br>
<table class="tabnoborder">
<tr> <td>wdshgkdjfh gkjhgfkjhfgskjfh</td>
<td>kjhv khgf hgfgh</td>
</tr>
<tr> <td>wdshgkdjfh gkjhgfkjhfgskjfh</td>
<td>kjhv khgf hgfgh</td>
</tr>
</table>
 
S

Steve Pugh

Frank said:
Rob and Sid, It doesn't make a difference how I do it, it does not work.
Example below. Notice that I used 2 tables with div and two with class= in
the <table>.
I want a definition for a table with border and one without. Strangest is
that if you switch the classes in place in the <style> the outcome is
totally different! How can that be!!

Regards
Frank

<style TYPE="text/css" MEDIA=screen>
.tabnoborder table{border: 0}

This applies to all tables inside elements with class="tabnoborder"
td {border: 0}

This applies to ALL table cells.
.tabwithborder table{border: 1px solid red}

This applies to all tables inside elements with class="tabwithborder"
td {border: 1px solid red}

This applies to ALL table cells, thus making the earlier style
redundent.

So you tables will either have no border or a red border depending on
the class of the div that contains them. But your table cells will
always have a red border.

If you want the td styles to apply to only those cells inside the
relevant divs then add the class selector before the td selector.

..tabnoborder table{border: 0}
..tabnoborder td {border: 0}
..tabwithborder table{border: 1px solid red}
..tabwithborder td {border: 1px solid red}

Or combine them (note the commas):

..tabnoborder table, .tabnoborder td {border: 0}
..tabwithborder table, .tabwithborder td {border: 1px solid red}

And why not get rid of the divs and apply the class to the table.

table.tabnoborder, table.tabnoborder td {border: 0}
table.tabwithborder, table.tabwithborder td {border: 1px solid red}

<table class="tabnoborder">

Steve
 
S

Sid Ismail

: Rob and Sid, It doesn't make a difference how I do it, it does not work.


Did you try mine? Please do?

Sid
 
S

Sid Ismail

:
: : > Hi, I have the next classes in a .css file:
: >
: > .tabelgeenborder {
: > table {border: 0}
: > td {border:0}
: > }
: > .vebrotabel {
: > table {border: 1px solid red;border-collapse:collapse}
: > td {border: 1px solid red}
: > }
: >
: > Only the second definition is recognized. If I use tabelgeenborder
: nothing
: > happens. Is this a bug or am I doing something wrong?
: >
: > Thanx
: >
: > Frank
: >
: >
: Rob and Sid, It doesn't make a difference how I do it, it does not work.
: Example below. Notice that I used 2 tables with div and two with class= in
: the <table>.
: I want a definition for a table with border and one without. Strangest is
: that if you switch the classes in place in the <style> the outcome is
: totally different! How can that be!!
:
: Regards
: Frank
:
: <style TYPE="text/css" MEDIA=screen>
: .tabnoborder table{border: 0}
: td {border: 0}
: .tabwithborder table{border: 1px solid red}
: td {border: 1px solid red}
: </style>
: <div class="tabwithborder">
: <table>
: <tr> <td>wdshgkdjfh gkjhgfkjhfgskjfh</td>
: <td>kjhv khgf hgfgh</td>
: </tr>
: <tr> <td>wdshgkdjfh gkjhgfkjhfgskjfh</td>
: <td>kjhv khgf hgfgh</td>
: </tr>
: </table></div>
: <div class="tabnoborder"><br>
: <table>
: <tr> <td>wdshgkdjfh gkjhgfkjhfgskjfh</td>
: <td>kjhv khgf hgfgh</td>
: </tr>
: <tr> <td>wdshgkdjfh gkjhgfkjhfgskjfh</td>
: <td>kjhv khgf hgfgh</td>
: </tr>
: </table></div><br>
: <table class="tabwithborder">
: <tr> <td>wdshgkdjfh gkjhgfkjhfgskjfh</td>
: <td>kjhv khgf hgfgh</td>
: </tr>
: <tr> <td>wdshgkdjfh gkjhgfkjhfgskjfh</td>
: <td>kjhv khgf hgfgh</td>
: </tr>
: </table><br>
: <table class="tabnoborder">
: <tr> <td>wdshgkdjfh gkjhgfkjhfgskjfh</td>
: <td>kjhv khgf hgfgh</td>
: </tr>
: <tr> <td>wdshgkdjfh gkjhgfkjhfgskjfh</td>
: <td>kjhv khgf hgfgh</td>
: </tr>
: </table>
:


See: http://www.elsid.co.za/testing/testcss.html

Sid
 
F

Frank

Sid Ismail said:
: Rob and Sid, It doesn't make a difference how I do it, it does not work.


Did you try mine? Please do?

Sid
I did Sid, didn't work. But Steve gave what I needed. I figured that out 3
minutes before I read his (very prompt) response.

Thanx both
Frank
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,085
Messages
2,570,597
Members
47,218
Latest member
GracieDebo

Latest Threads

Top