securecatの日記: Re: 09日(水) - 偽偽夜食日記の部屋
09日(水)より。
CSSでテーブルを表現する時、HTMLでのcolspanやrowspanはどうやって表現すればいいのだろう。
[...]
うーん、CSS2レベルではできないのだろうか。
できません。
17.5 Visual layout of table contentsにも、「Cells may span several rows or columns. (Although CSS2 doesn't define how the number of spanned rows or columns is determined, a user agent may have special knowledge about the source document; a future version of CSS may provide a way to express this knowledge in CSS syntax.)」とあります。
それらは表現ではなくて論理的な構造だと言われればそうかもしれないが、それを言ったらdisplayプロパティのテーブル系の値はみんなそうな訳で。
17.1 Introduction to tablesに「Tables represent relationships between data. Authors specify these relationships in the document language and specify their presentation in CSS, in two ways: visually and aurally.」とあるように、表内の各値がそれぞれどのような関係性を持ったうえで表となっているかっていうのは、HTMLなりXMLなりで定義されるものでしょう。
17.2 The CSS table modelには「The CSS model does not require that the document language include elements that correspond to each of these components. For document languages (such as XML applications) that do not have pre-defined table elements, authors must map document language elements to table elements; this is done with the 'display' property. The following 'display' values assign table semantics to an arbitrary element:」と書いてあるわけですが、ようするにtable系のdisplay特性は、あらかじめ表要素が用意されていないdocument languageの時に指定しましょうってな感じになっています。CSSがXMLなどのマークアップ言語の意味を補完するかのような。なんだか微妙な説明の気もしますけど。
ところでCSSでcolspan/rowspanつながり(謎)なんだけど、話はやや逸れますが、ともかく第10話: CSSの利用(1) [複雑な表]というのを見つけました。
ちょっと何だか凄い感じです。「より構造化されたテキストになるため視認性が良く、理解しやすく、追加・修正等のメンテナンスも楽になることは間違いないと思います。」ってマジですかというか。ソースをどう見ても「CAD」と「Mechanical Desktop」が同じ位置付けにあるようにしか見えませんし、その状態を“より構造化されている”といって良いものやら……。
とりあえず、視認性は、複雑なテーブルというかネストしまくったテーブルのソースに比べれば、セルの中身が何なのかわかるとかいう次元では良くなっているかもしれませんが、表としての内容を理解しやすいとはちょっと思えないし、メンテナンス性も悪いと思いました。
Re: 09日(水) - 偽偽夜食日記の部屋 More ログイン