Re: HTML/CSS issues

Todd Slater <[email protected]>
Newsgroups gmane.comp.apache.mod-survey.general
Message-ID <[email protected]>
OK, I understand now. I couldn't understand at first because I'm so
accustomed to writing out class declarations in full, probably from
working with crappy browsers (IE) back in the day.

My approach would probably be to write out each class:

.questionGreen {
	display: block;
	width: 800px;
	border: solid 1px green;
	}
.questionRed {
	display: block;
	width: 800px;
	border: solid 1px red;
	}

But you're right, that does seem inefficient. Another option is to
specify a style in the HTML.

<html>
  <head>
  <style type="text/css">
  <!--
  .question {
  	display: block;
	width: 800px;
	margin: 1em;
	border: solid 1px green;
	}
  -->
  </style>
  </head>
  <body>
  	<div class="question"> .. </div>
  	<div class="question"> .. </div>
	<div class="question" style="border-color:red;"> .. </div>
	<div class="question"> .. </div>
  </body>
</html>	

Hmm, none of these solutions is very pretty. I guess you'll need to
decide if you want the HTML output to validate and go from there. :)

Todd

On Tue, Aug 17, 2004 at 12:51:03PM +0200, Joel Palmius wrote:
> 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

-- 
Name that tune #21: I live in the ghetto, you just come to visit me
around election time.
Skickat av Todd Slater <[email protected]>
till survey-discussion
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.