CSS classes should be applied to elements directly, not divs

Issue #3 open
Luke Plant
repo owner created an issue

For block level elements (not sections), the CSS class should be applied to the element, not a div enclosing the element.

Probably. (Need confirmation on this).

Comments (5)

  1. evildmp

    It's a tricky question.

    I think that being able to apply styling to rows and columns explicitly will help resolve some of the ambiguities.

    Then, a style such as "tint1" applied to a block-level element should generally apply to the element - except when it's a heading (a heading should be thought of as enclosing the elements that come beneath it).

    But it's not obvious how to behave when a heading has a style applied, and then a column or row ends.

  2. Luke Plant reporter

    OK, here's the situation:

    With my recent changes styles are currently applied always to the element they are chosen for. There are no enclosing divs that are defined by the headings -- these have been removed, because it turns out that this simply isn't compatible with the flexibility in column layout that you want.

    If you select a row or column, you can add styles to that, and they get applied to the relevant div, so you could style a chunk of text that way, even if you wouldn't otherwise be using rows e.g. do this:

    [New row]

    Some content here

    [New row]

    More content

    [New row]




    Each of these sections can then be styled individually.

    If you want to have sections that are defined automatically by headings, so that you can click a heading and apply a style to the whole section beneath it, I can think of ways to do this, and with my rework it is much more possible. It is still quite a bit of work, because you will now have the possibility of a single section (e.g. that defined by a H1 heading) that is split across multiple divs (because of column breaks). If the styling for that class is something like a border, things could wrong easily, because you would now have multiple rectangles with the border, instead of one.

    From the users point of view, one way to do it is to define certain CSS classes as being 'section classes'. This would go in the database model, and the code would then know that these classes are to be applied to sections rather than the heading elements themselves.

  3. Log in to comment