Re: HTML/CSS issues
Joel Palmius <[email protected]>
| Newsgroups | gmane.comp.apache.mod-survey.general |
|---|---|
| Message-ID | <[email protected]> |
Well, the theory is that I should only have to define common attributes
once. To illustrate, imagine I have this css:
#parent { display: block;
width: 800px;
border-style: solid;
border-width: 3px;
}
.child1 { }
.child2 { }
.child3 { }
.child4 { border-color: red; }
.child5 { }
and this html:
<html>
<head>
<link rel="stylesheet" href="main.css" type="text/css" />
</head>
<body>
<div id="parent" class="child1">..</div><br /><br />
<div id="parent" class="child2">..</div><br /><br />
<div id="parent" class="child3">..</div><br /><br />
<div id="parent" class="child4">..</div><br /><br />
<div id="parent" class="child5">..</div><br /><br />
</body>
</html>
Here I will now get a number of black rectangles, except for the fourth
which is red. If I want to change the width of the borders I need only do
that in #parent.
The alternative would of course be copy/pasting the contents of #parent
into each child, but then I'd have to change the border width in five
places if I wanted to do that.
My late-night suggestion won't work either. If parent was a normal class,
then the following:
<div class="parent">
<div class="child4">
..
</div>
</div>
would either result in a red border *inside* a black border, or in most
browsers no red border at all.
I'm open for suggestions. While we're at it, suggestion on where/how to
insert more div tags in the output is also welcome.
I'm probably a bit spoiled by having worked mostly with java lately.
Ideally something like this should be possible to define in CSS:
.parent { [..lots of settings..] }
.child4 { inherit(parent) [.. add/override settings ..] }
// Joel
On Mon, 16 Aug 2004, Todd Slater wrote:
> On Mon, Aug 16, 2004 at 09:36:49PM +0200, Joel Palmius wrote:
>> I know the id/class thing is not very beautiful, but it was the only way I
>> could think up in order to get inheritance. Before removing this, I'd like
>> to discuss alternatives.
>>
>> Apart from being ugly and not passing through the w3c validator, does it
>> cause problems in any browser?
>
> Joel, I think most browsers just ignore the id's and so should work
> regardless. How about if I work up an example of different question
> types without using id's and include the corresponding style sheet?
> Better still, I'm not sure I understand why inheritance is needed--or,
> what are you trying that can't be achieved with a class declaration?
>
> Todd
>
>>
>>
>> On Fri, 13 Aug 2004, Todd Slater wrote:
>>
>>> Using 3.2 rc1 I am glad to see that there are more div's in the HTML
>>> that Mod_survey generates to give designers more control over a survey's
>>> look. Unfortunately, the use of "id=mds[component|caption|question]" in
>>> each question is not valid. The id tag must be unique, so the surveys will
>>> not
>>> validate. I've been going through the files in Survey and
>>> Survey/Components and removing the references to id=*. I am using an old
>>> stylesheet I made for a previous release and I just had to change a
>>> couple of things in it to get it to display as expected, but I imagine
>>> for the rest of you it would break the css examples included.
>>>
>>> I'm not great with CVS but I have a feeling I should be working on
>>> it--assuming things have already changed since the release I'm working
>>> on. I've not been following the list recently so if I'm off let me know.
>>>
>>> Todd
>
> --
> Name that tune #11: If I were David Byrne, I'd go to galleries and not be
> too concerned; and I would have a cup of coffee, and I'd find my
> surroundings quite amusing and people would ask me which were my favorite
> paintings.
> Skickat av Todd Slater <[email protected]>
> till survey-discussion
>
Skickat av Joel Palmius <[email protected]>
till survey-discussion