From: Andrew Ballard on 6 Aug 2010 09:09 On Fri, Aug 6, 2010 at 8:31 AM, tedd <tedd.sperling(a)gmail.com> wrote: > While it may not be obvious, the statement: > > <table border="1"> > > is flawed (IMO). > > The "best" way to handle this is to define a class (or id) for the table in > a css file and then set the border (i.e., styling) to whatever you want. For > example, your HTML would look like: > > <table class="my_table"> > > And your CSS would contain: > > .my_table > Â { > Â border: 1px solid black; > Â } > I more or less agree with you, but sometimes it's technically a little more difficult than that. The border attribute on the table tag affects not only the table itself, but also the cells inside it. The CSS attribute only draws a border around the table. I believe the CSS equivalent of how most browsers (I tested Fx 3.6.8, IE 7, Google Chrome 5, Opera 10.53, and Safari (Windows) 5.0.1) render <table border="1"> takes a little more: table.my_table, table.my_table > thead > tr > th, table.my_table > tbody > tr > th, table.my_table > tfoot > tr > th, table.my_table > thead > tr > td, table.my_table > tbody > tr > td, table.my_table > tfoot > tr > td { border: solid 1px black; } And, of the browsers listed above, IE7 did not render the table correctly. (I'm guessing it must not properly handle the child CSS selectors.) If you do it without the child selectors: table.my_table, table.my_table th, table.my_table td { border: solid 1px black; } All the browsers render it the same, but it has the side effect that cells in nested tables also inherit the borders unless you do something to exclude them: table.my_table, table.my_table th, table.my_table td { border: solid 1px black; } table.my_table table, table.my_table table th, table.my_table table td { border: none; } As is often the case with CSS, that's a good bit more text to accomplish the same effect as an older, smaller attribute. :-) Andrew
From: tedd on 6 Aug 2010 10:11 At 9:09 AM -0400 8/6/10, Andrew Ballard wrote: >On Fri, Aug 6, 2010 at 8:31 AM, tedd <tedd.sperling(a)gmail.com> wrote: >> While it may not be obvious, the statement: >> > > <table border="1"> >> >> is flawed (IMO). >> >> The "best" way to handle this is to define a class (or id) for the table in >> a css file and then set the border (i.e., styling) to whatever you want. For >> example, your HTML would look like: >> >> <table class="my_table"> >> >> And your CSS would contain: >> >> .my_table >> { >> border: 1px solid black; >> } >> > >I more or less agree with you, but sometimes it's technically a little >more difficult than that. > >-snip- > >As is often the case with CSS, that's a good bit more text to >accomplish the same effect as an older, smaller attribute. :-) > >Andrew Andrew: The problem you cite is well said and your point is well taken. However, the main point I am making is to move this problem totally out of the HTML/PHP arena and place it where it belongs, which is inside CSS -- after it *is* a presentation problem. IMO, it is *far* better to deal with browser comparability problems from one CSS file than it is to sort through all your PHP files looking for the phrase <table border="1">. From my experience, when you have a problem, it is always better to give it a name and deal with it from one location. As for "older, smaller attributes", they are only getting older and their importance lessens with time (I can relate.) :-) Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com
From: Bill Guion on 6 Aug 2010 11:18 At 8:31 AM -0400 08/06/10, tedd wrote: >Cheers, > >tedd > >PS: Considering that this is Friday. I have a grammar question for >the group. I said above: > >"neither CSS, PHP, or any web language exist in a vacuum." > >Is the word "neither" appropriate in this sentence? > >Normally, two items can be compared by "neither" or "nor", but what >about more than two items? Is it appropriate to use "neither" or >"nor" for more than two items? Somewhere along the line, probably in college (if it were before college, it would have been so long ago I would have forgotten it), a professor said to handle this sort of thing thusly: neither A, nor B, nor C .... A little more wordy, but completely unambiguous. -----===== Bill =====----- -- Don't find fault. Find a remedy. - Henry Ford
From: Richard Quadling on 6 Aug 2010 11:45 On 6 August 2010 16:18, Bill Guion <bguion(a)comcast.net> wrote: > At 8:31 AM -0400 08/06/10, tedd wrote: > >> Cheers, >> >> tedd >> >> PS: Considering that this is Friday. I have a grammar question for the >> group. I said above: >> >> "neither CSS, PHP, or any web language exist in a vacuum." >> >> Is the word "neither" appropriate in this sentence? >> >> Normally, two items can be compared by "neither" Â or "nor", but what about >> more than two items? Is it appropriate to use "neither" Â or "nor" for more >> than two items? > > Somewhere along the line, probably in college (if it were before college, it > would have been so long ago I would have forgotten it), a professor said to > handle this sort of thing thusly: > > neither A, nor B, nor C .... > > A little more wordy, but completely unambiguous. "neither CSS, PHP, nor any web language exist in a vacuum." would probably do. All negatives, so little wiggle room really.
First
|
Prev
|
Pages: 1 2 3 4 Prev: PHP The Anthem Next: Protecting PHP scripts called via AJAX from evil |