26 Replies Latest reply on May 22, 2006 7:26 PM by Newsgroup_User

    Defining constants

    Level 7
      I am still completely baffled by my misbehaving tables, so I thought I would try
      Murray's suggestion and get rid of the colspans and rowspans. While I was about
      it, I thought would be nice to centralise all my magic numbers (such as the
      colour of the body of the table, the tables containing the images, and so on) in
      the CSS file.

      For example I might wish to define body_colour as #f8f8ff. This ought to be
      (and undoubtedly is) dead easy, but, despite all the books on CSS I have lying
      around, none list "defining constants", or any equivalent I can think of, in the
      index. Nor can I find any examples which demonstrate how to do this.

      So the question is
      a. How do I define a constants in the CSS file, and
      b. How do I use it in the HTML?


      Clancy@cybec.com.au
        • 1. Re: Defining constants
          Level 7
          > a. How do I define a constants in the CSS file, and
          > b. How do I use it in the HTML?

          body { color:#f8f8ff; }

          There are no 'constants' in CSS - only rules and styles. However, on a page
          with a valid and complete doctype, this color will inherit into everything
          else on the page.


          --
          Murray --- ICQ 71997575
          Adobe Community Expert
          (If you *MUST* email me, don't LAUGH when you do so!)
          ==================
          http://www.dreamweavermx-templates.com - Template Triage!
          http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
          http://www.dwfaq.com - DW FAQs, Tutorials & Resources
          http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
          ==================


          "Clancy" <clancy@cybec.com.au> wrote in message
          news:kkro62dmeep3j35ffeb3a3i2snb89bbmu3@4ax.com...
          >I am still completely baffled by my misbehaving tables, so I thought I
          >would try
          > Murray's suggestion and get rid of the colspans and rowspans. While I was
          > about
          > it, I thought would be nice to centralise all my magic numbers (such as
          > the
          > colour of the body of the table, the tables containing the images, and so
          > on) in
          > the CSS file.
          >
          > For example I might wish to define body_colour as #f8f8ff. This ought to
          > be
          > (and undoubtedly is) dead easy, but, despite all the books on CSS I have
          > lying
          > around, none list "defining constants", or any equivalent I can think of,
          > in the
          > index. Nor can I find any examples which demonstrate how to do this.
          >
          > So the question is
          > a. How do I define a constants in the CSS file, and
          > b. How do I use it in the HTML?
          >
          >
          > Clancy@cybec.com.au


          • 2. Re: Defining constants
            Level 7
            Well, the values you assign in a CSS file are constant, as the file that
            you are linking to cannot be changed.

            to change all tables you simply give values to the table tag

            table {background-color: #f8f8ff;}


            If you want the body color of a specific table you would use and ID (or
            class if you have more than one on each page with the same values)

            #mytable {background-color: #f8f8ff;}

            HTML:

            <table id="mytable">
            .....
            </table>



            Anurag


            Clancy wrote:
            > I am still completely baffled by my misbehaving tables, so I thought I would try
            > Murray's suggestion and get rid of the colspans and rowspans. While I was about
            > it, I thought would be nice to centralise all my magic numbers (such as the
            > colour of the body of the table, the tables containing the images, and so on) in
            > the CSS file.
            >
            > For example I might wish to define body_colour as #f8f8ff. This ought to be
            > (and undoubtedly is) dead easy, but, despite all the books on CSS I have lying
            > around, none list "defining constants", or any equivalent I can think of, in the
            > index. Nor can I find any examples which demonstrate how to do this.
            >
            > So the question is
            > a. How do I define a constants in the CSS file, and
            > b. How do I use it in the HTML?
            >
            >
            > Clancy@cybec.com.au
            • 3. Re: Defining constants
              Level 7
              You are not the first person who would like to be able to use constants
              in CSS, and not the first to discover that they don't exist.

              --
              James M. Shook
              http://www.jshook.com
              • 4. Re: Defining constants
                Level 7
                Anurag <chetan_anurag@yahoo.de> wrote:

                >Well, the values you assign in a CSS file are constant, as the file that
                >you are linking to cannot be changed.
                >
                >to change all tables you simply give values to the table tag
                >
                >table {background-color: #f8f8ff;}
                >
                >
                >If you want the body color of a specific table you would use and ID (or
                >class if you have more than one on each page with the same values)
                >
                >#mytable {background-color: #f8f8ff;}
                >
                >HTML:
                >
                ><table id="mytable">
                >.....
                ></table>

                Thank you.

                That enables me to do what I want to do.



                Clancy@cybec.com.au
                • 5. Re: Defining constants
                  Level 7
                  James Shook <jshook@dont_mail.com> wrote:

                  >You are not the first person who would like to be able to use constants
                  >in CSS, and not the first to discover that they don't exist.

                  That isn't surprising. Clearly CSS wasn't designed by a Real Programmer�.
                  Every proper programming language has constants!


                  Clancy@cybec.com.au
                  • 6. Re: Defining constants
                    Level 7
                    On Fri, 19 May 2006 17:59:52 +1000, Clancy <clancy@cybec.com.au> wrote:

                    >That isn't surprising. Clearly CSS wasn't designed by a Real Programmer�.
                    >Every proper programming language has constants!


                    Cascading Style Sheets are not a programming language.

                    Gary
                    • 7. Re: Defining constants
                      Level 7
                      Clancy wrote:

                      > That isn't surprising. Clearly CSS wasn't designed by a Real Programmer�.
                      > Every proper programming language has constants!

                      CSS isn't a programming language.

                      --
                      James M. Shook
                      http://www.jshook.com
                      • 8. Re: Defining constants
                        Level 7
                        Clancy wrote:

                        > That isn't surprising. Clearly CSS wasn't designed by a Real Programmer�.
                        > Every proper programming language has constants!

                        NOT TRUE...
                        Mick
                        • 9. Re: Defining constants
                          Level 7
                          Mick White <himselfBOGUS@mickweb.com> wrote:

                          >Clancy wrote:
                          >
                          >> That isn't surprising. Clearly CSS wasn't designed by a Real Programmer�.
                          >> Every proper programming language has constants!
                          >
                          >NOT TRUE...
                          >Mick

                          Name one. Even assembler has constants!


                          Clancy@cybec.com.au
                          • 10. Re: Defining constants
                            Level 7
                            James Shook <jshook@dont_mail.com> wrote:

                            >Clancy wrote:
                            >
                            >> That isn't surprising. Clearly CSS wasn't designed by a Real Programmer�.
                            >> Every proper programming language has constants!
                            >
                            >CSS isn't a programming language.

                            Maybe not, but it's a sort of ******* data file, and it could quite easily have
                            included constants. And these in turn would be quite handy.


                            Clancy@cybec.com.au
                            • 11. Re: Defining constants
                              Level 7
                              > Maybe not, but it's a sort of ******* data file

                              It's a set of styles. That's all. I don't see much use for constants,
                              frankly.

                              --
                              Murray --- ICQ 71997575
                              Adobe Community Expert
                              (If you *MUST* email me, don't LAUGH when you do so!)
                              ==================
                              http://www.dreamweavermx-templates.com - Template Triage!
                              http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                              http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                              http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
                              ==================


                              "Clancy" <clancy@cybec.com.au> wrote in message
                              news:a5tt6297hlkl8i5ijvp6l9h12njtvtsk4n@4ax.com...
                              > James Shook <jshook@dont_mail.com> wrote:
                              >
                              >>Clancy wrote:
                              >>
                              >>> That isn't surprising. Clearly CSS wasn't designed by a Real
                              >>> Programmer�.
                              >>> Every proper programming language has constants!
                              >>
                              >>CSS isn't a programming language.
                              >
                              > Maybe not, but it's a sort of ******* data file, and it could quite easily
                              > have
                              > included constants. And these in turn would be quite handy.
                              >
                              >
                              > Clancy@cybec.com.au


                              • 12. Re: Defining constants
                                Level 7
                                Anurag <chetan_anurag@yahoo.de> wrote:

                                >Well, the values you assign in a CSS file are constant, as the file that
                                >you are linking to cannot be changed.
                                >
                                >to change all tables you simply give values to the table tag
                                >
                                >table {background-color: #f8f8ff;}
                                ........
                                Thank you for your suggestion. I have been experimenting with this, but have
                                not managed to get it working properly.

                                Whenever I have an image on a page (and often there are several), I enclose it
                                in a table which acts as a picture frame. The standard format I use is:

                                <table width="25%" border="0" align="right" cellpadding="10" cellspacing="0"
                                bgcolor="#f0f0f8">
                                <tr>
                                <td align="center" valign="top">
                                <p><img src="../Images/One_day.jpg"
                                width="81" height="108"></p>
                                <p class="notetext">Caption</p>
                                <p class="bodytext">Text</p>
                                </td>
                                </tr>
                                </table>

                                (The image 'One_day.jpg' is simply a placeholder.)

                                I would like all the parameters associated with the table (apart from 'align')
                                to be specified in the CSS file. I have tried the following definition:

                                #pictureframe {width: 5%; background-color: #c0c0f8; cellpadding: 20;
                                cellspacing: 0; border-width: 20; border-color:#7F0000;}

                                I invoke this with:

                                <table id="pictureframe">

                                Width and background colour seem to work, but the rest don't. I have had border
                                width and border colour working but currently they are not. What am I doing
                                wrongly? And how do I add parameters (like 'align', which is variable) to the
                                parameters specified in the CSS file?


                                Clancy@cybec.com.au
                                • 13. Re: Defining constants
                                  Level 7
                                  #firstColumn {
                                  width: 20em;
                                  }

                                  #secondColumn{
                                  width: 50em;
                                  }

                                  #columnFooter {
                                  width: #firstColumn.width + #secondColumn.width
                                  }

                                  is the sort of thing I was thinking of. I'm sure there are even more
                                  useful applications of the idea.

                                  --
                                  James M. Shook
                                  http://www.jshook.com
                                  • 14. Re: Defining constants
                                    Level 7
                                    On Sat, 20 May 2006 08:57:06 -0400, James Shook <jshook@dont_mail.com>
                                    wrote:

                                    >#columnFooter {
                                    > width: #firstColumn.width + #secondColumn.width
                                    >}
                                    >
                                    >is the sort of thing I was thinking of. I'm sure there are even more
                                    >useful applications of the idea.


                                    But that's not a constant. It's a variable.

                                    Gary
                                    • 15. Re: Defining constants
                                      Level 7
                                      On Sat, 20 May 2006 20:53:36 +1000, Clancy <clancy@cybec.com.au> wrote:

                                      >Maybe not, but it's a sort of ******* data file


                                      Not really. CSS is a set of style rules. It doesn't make decisions or
                                      take actions.

                                      Gary
                                      • 16. Re: Defining constants
                                        Level 7
                                        Gary White wrote:

                                        > But that's not a constant. It's a variable.

                                        Picky, picky. But you're right. I was thinking variables all along.

                                        --
                                        James M. Shook
                                        http://www.jshook.com
                                        • 17. Re: Defining constants
                                          Level 7
                                          Clancy wrote:
                                          > Thank you for your suggestion. I have been experimenting with this, but have
                                          > not managed to get it working properly.
                                          >
                                          > Whenever I have an image on a page (and often there are several), I enclose it
                                          > in a table which acts as a picture frame. The standard format I use is:
                                          >
                                          > <table width="25%" border="0" align="right" cellpadding="10" cellspacing="0"
                                          > bgcolor="#f0f0f8">
                                          > <tr>
                                          > <td align="center" valign="top">
                                          > <p><img src="../Images/One_day.jpg"
                                          > width="81" height="108"></p>
                                          > <p class="notetext">Caption</p>
                                          > <p class="bodytext">Text</p>
                                          > </td>
                                          > </tr>
                                          > </table>
                                          >
                                          > (The image 'One_day.jpg' is simply a placeholder.)
                                          >
                                          > I would like all the parameters associated with the table (apart from 'align')
                                          > to be specified in the CSS file. I have tried the following definition:
                                          >
                                          > #pictureframe {width: 5%; background-color: #c0c0f8; cellpadding: 20;
                                          > cellspacing: 0; border-width: 20; border-color:#7F0000;}
                                          >
                                          > I invoke this with:
                                          >
                                          > <table id="pictureframe">
                                          >
                                          > Width and background colour seem to work, but the rest don't. I have had border
                                          > width and border colour working but currently they are not. What am I doing
                                          > wrongly? And how do I add parameters (like 'align', which is variable) to the
                                          > parameters specified in the CSS file?
                                          >
                                          >
                                          > Clancy@cybec.com.au

                                          It would be better to post a link to the page; otherwise it's still a
                                          bit hard to see what you are trying to do. I assume from the above you
                                          are placing all your photos inside single-cell tables?

                                          --
                                          Bonnie in California
                                          kroko at
                                          pixelplum dot com
                                          http://www.theanimalrescuesite.com/cgi-bin/WebObjects/CTDSites.woa
                                          • 18. Re: Defining constants
                                            Level 7
                                            Bonnie wrote:
                                            > Clancy wrote:
                                            >
                                            >> Thank you for your suggestion. I have been experimenting with this,
                                            >> but have
                                            >> not managed to get it working properly.
                                            >> Whenever I have an image on a page (and often there are several), I
                                            >> enclose it
                                            >> in a table which acts as a picture frame. The standard format I use is:
                                            >>
                                            >> <table width="25%" border="0" align="right" cellpadding="10"
                                            >> cellspacing="0" bgcolor="#f0f0f8">
                                            >> <tr>
                                            >> <td align="center" valign="top">
                                            >> <p><img src="../Images/One_day.jpg" width="81"
                                            >> height="108"></p>
                                            >> <p class="notetext">Caption</p>
                                            >> <p class="bodytext">Text</p>
                                            >> </td>
                                            >> </tr>
                                            >> </table>
                                            >>
                                            >> (The image 'One_day.jpg' is simply a placeholder.)
                                            >>
                                            >> I would like all the parameters associated with the table (apart from
                                            >> 'align')
                                            >> to be specified in the CSS file. I have tried the following definition:
                                            >>
                                            >> #pictureframe {width: 5%; background-color: #c0c0f8; cellpadding: 20;
                                            >> cellspacing: 0; border-width: 20; border-color:#7F0000;}
                                            >>
                                            >> I invoke this with:
                                            >>
                                            >> <table id="pictureframe">
                                            >> Width and background colour seem to work, but the rest don't. I have
                                            >> had border
                                            >> width and border colour working but currently they are not. What am I
                                            >> doing
                                            >> wrongly? And how do I add parameters (like 'align', which is
                                            >> variable) to the
                                            >> parameters specified in the CSS file?
                                            >>
                                            >>
                                            >> Clancy@cybec.com.au
                                            >
                                            >
                                            > It would be better to post a link to the page; otherwise it's still a
                                            > bit hard to see what you are trying to do. I assume from the above you
                                            > are placing all your photos inside single-cell tables?
                                            >

                                            #pictureframe {width: 5%; background-color: #c0c0f8; cellpadding: 20px;cellspacing: 0;
                                            border-width: 20px; border-color:#7F0000;}

                                            note I added "px" next to your cellpadding a border-width values

                                            --
                                            seb ( ---@webtrans1.com)
                                            http://webtrans1.com | high-end web design
                                            Downloads: Slide Show, Directory Browser, Mailing List
                                            • 19. Re: Defining constants
                                              Level 7
                                              (_seb_) wrote:
                                              > Bonnie wrote:
                                              >
                                              >> Clancy wrote:
                                              >>
                                              >>> Thank you for your suggestion. I have been experimenting with this,
                                              >>> but have
                                              >>> not managed to get it working properly.
                                              >>> Whenever I have an image on a page (and often there are several), I
                                              >>> enclose it
                                              >>> in a table which acts as a picture frame. The standard format I use is:
                                              >>>
                                              >>> <table width="25%" border="0" align="right" cellpadding="10"
                                              >>> cellspacing="0" bgcolor="#f0f0f8">
                                              >>> <tr>
                                              >>> <td align="center" valign="top">
                                              >>> <p><img src="../Images/One_day.jpg" width="81"
                                              >>> height="108"></p>
                                              >>> <p class="notetext">Caption</p>
                                              >>> <p class="bodytext">Text</p>
                                              >>> </td>
                                              >>> </tr>
                                              >>> </table>
                                              >>>
                                              >>> (The image 'One_day.jpg' is simply a placeholder.)
                                              >>>
                                              >>> I would like all the parameters associated with the table (apart from
                                              >>> 'align')
                                              >>> to be specified in the CSS file. I have tried the following definition:
                                              >>>
                                              >>> #pictureframe {width: 5%; background-color: #c0c0f8; cellpadding: 20;
                                              >>> cellspacing: 0; border-width: 20; border-color:#7F0000;}
                                              >>>
                                              >>> I invoke this with:
                                              >>>
                                              >>> <table id="pictureframe">
                                              >>> Width and background colour seem to work, but the rest don't. I have
                                              >>> had border
                                              >>> width and border colour working but currently they are not. What am
                                              >>> I doing
                                              >>> wrongly? And how do I add parameters (like 'align', which is
                                              >>> variable) to the
                                              >>> parameters specified in the CSS file?
                                              >>>
                                              >>>
                                              >>> Clancy@cybec.com.au
                                              >>
                                              >>
                                              >>
                                              >> It would be better to post a link to the page; otherwise it's still a
                                              >> bit hard to see what you are trying to do. I assume from the above
                                              >> you are placing all your photos inside single-cell tables?
                                              >>
                                              >
                                              > #pictureframe {width: 5%; background-color: #c0c0f8; cellpadding:
                                              > 20px;cellspacing: 0; border-width: 20px; border-color:#7F0000;}
                                              >
                                              > note I added "px" next to your cellpadding a border-width values
                                              >

                                              and oh I forgot, cellspacing is NOT part of CSS.
                                              You need to remove it from your style, and keep it in the table tag as an html attribute:

                                              <table id="pictureframe" cellspacing=0>

                                              --
                                              seb ( ---@webtrans1.com)
                                              http://webtrans1.com | high-end web design
                                              Downloads: Slide Show, Directory Browser, Mailing List
                                              • 20. Re: Defining constants
                                                Level 7
                                                damn sorry for the repeated corrections, I also overlooked this: in CSS cellpadding does not exist,
                                                only padding does. And you cloud simplify your border-style:

                                                #pictureframe {width: 5%; background-color:#c0c0f8; padding:20px; border:20px solid #7F0000;}

                                                --
                                                seb ( ---@webtrans1.com)
                                                http://webtrans1.com | high-end web design
                                                Downloads: Slide Show, Directory Browser, Mailing List
                                                • 21. Re: Defining constants
                                                  Level 7
                                                  Bonnie <"kroko[Occam]"@pixelplum.com> wrote:

                                                  >It would be better to post a link to the page; otherwise it's still a
                                                  >bit hard to see what you are trying to do. I assume from the above you
                                                  >are placing all your photos inside single-cell tables?

                                                  Yes; I have put an example of what I am trying to do at
                                                  http://www.cybec.com.au/Test_nstdpage.htm

                                                  I have got a little further with my experiments. The specification for the
                                                  picture frame is now

                                                  #pictureframe {width: 5%; background-color: #d8d8f0; border: 5px solid #88d8e0;
                                                  }

                                                  I have finally got the border to work properly, though I had no idea why it
                                                  wasn't working half an hour ago -- I could have sworn that I had exactly the
                                                  same code that have now. I don't want a border at all; I just want to specify
                                                  some padding. The image frames clearly have 2px or 3px of padding, but I cannot
                                                  find out where this value comes from, or how to change it.

                                                  However, with what I have got working, I can fake the result I wants by setting
                                                  the border colour to be the same as the background colour. I guess this will
                                                  do, unless someone can tell me how to make the padding work.

                                                  And, in case you are wondering why I want to specify these values in the CSS
                                                  file, rather than the template, if they are in the CSS file I can change the
                                                  appearance of every image on the web site by changing the specification of the
                                                  picture frame.

                                                  However the pictures are in the editable region of the template, so if I
                                                  specified the values in the template I would be unable to modify the appearance
                                                  of the images once the pages had been created.

                                                  Clancy@cybec.com.au
                                                  • 22. Re: Defining constants
                                                    Level 7
                                                    First, please get rid of the spaces in your filenames!

                                                    <img src="Images/Mr Vet.jpg"

                                                    Also, note that any given ID can only be used ONCE on any page -

                                                    <table id="pictureframe">
                                                    ...
                                                    <table id="pictureframe" align="right">

                                                    If you want to do this kind of thing, make it a custom class selector (e.g.,
                                                    <table class="pictureframe"> , or figure out how to use descendent selectors
                                                    to cascade into each desired element. You double instances of #pictureframe
                                                    is most likely the cause of your results.

                                                    Your CSS is way unnecessarily verbose, redundant, and cluttered, but I
                                                    suspect that's not what you are looking for right now.

                                                    > The image frames clearly have 2px or 3px of padding, but I cannot
                                                    > find out where this value comes from, or how to change it.

                                                    Most likely from the text box within which all inline tags are rendered.
                                                    Try adding "display:block" to your image CSS to see if that would fix this.

                                                    > However the pictures are in the editable region of the template, so if I
                                                    > specified the values in the template I would be unable to modify the
                                                    > appearance
                                                    > of the images once the pages had been created.

                                                    Sure you can. Just add a little stylesheet to the editable region in the
                                                    head of the child page to override the base CSS.

                                                    --
                                                    Murray --- ICQ 71997575
                                                    Adobe Community Expert
                                                    (If you *MUST* email me, don't LAUGH when you do so!)
                                                    ==================
                                                    http://www.dreamweavermx-templates.com - Template Triage!
                                                    http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                                                    http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                                                    http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
                                                    ==================


                                                    "Clancy" <clancy@cybec.com.au> wrote in message
                                                    news:ks73721fr37f18538on7jigsgbe78pnoen@4ax.com...
                                                    > Bonnie <"kroko[Occam]"@pixelplum.com> wrote:
                                                    >
                                                    >>It would be better to post a link to the page; otherwise it's still a
                                                    >>bit hard to see what you are trying to do. I assume from the above you
                                                    >>are placing all your photos inside single-cell tables?
                                                    >
                                                    > Yes; I have put an example of what I am trying to do at
                                                    > http://www.cybec.com.au/Test_nstdpage.htm
                                                    >
                                                    > I have got a little further with my experiments. The specification for
                                                    > the
                                                    > picture frame is now
                                                    >
                                                    > #pictureframe {width: 5%; background-color: #d8d8f0; border: 5px solid
                                                    > #88d8e0;
                                                    > }
                                                    >
                                                    > I have finally got the border to work properly, though I had no idea why
                                                    > it
                                                    > wasn't working half an hour ago -- I could have sworn that I had exactly
                                                    > the
                                                    > same code that have now. I don't want a border at all; I just want to
                                                    > specify
                                                    > some padding. The image frames clearly have 2px or 3px of padding, but I
                                                    > cannot
                                                    > find out where this value comes from, or how to change it.
                                                    >
                                                    > However, with what I have got working, I can fake the result I wants by
                                                    > setting
                                                    > the border colour to be the same as the background colour. I guess this
                                                    > will
                                                    > do, unless someone can tell me how to make the padding work.
                                                    >
                                                    > And, in case you are wondering why I want to specify these values in the
                                                    > CSS
                                                    > file, rather than the template, if they are in the CSS file I can change
                                                    > the
                                                    > appearance of every image on the web site by changing the specification of
                                                    > the
                                                    > picture frame.
                                                    >
                                                    > However the pictures are in the editable region of the template, so if I
                                                    > specified the values in the template I would be unable to modify the
                                                    > appearance
                                                    > of the images once the pages had been created.
                                                    >
                                                    > Clancy@cybec.com.au


                                                    • 23. Re: Defining constants
                                                      Level 7
                                                      Clancy wrote:

                                                      > Mick White <himselfBOGUS@mickweb.com> wrote:
                                                      >
                                                      >
                                                      >>Clancy wrote:
                                                      >>
                                                      >>
                                                      >>>That isn't surprising. Clearly CSS wasn't designed by a Real Programmer�.
                                                      >>>Every proper programming language has constants!
                                                      >>
                                                      >>NOT TRUE...
                                                      >>Mick
                                                      >
                                                      >
                                                      > Name one. Even assembler has constants!
                                                      >

                                                      javascript

                                                      Mick
                                                      • 24. Re: Defining constants
                                                        Level 7
                                                        "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote:

                                                        >> Maybe not, but it's a sort of ******* data file
                                                        >
                                                        >It's a set of styles. That's all. I don't see much use for constants,
                                                        >frankly.

                                                        The single biggest virtue of using CSS is that anything defined in the CSS file
                                                        affects the whole of your site, and you can immediately change any property it
                                                        defines simply by changing the CSS file and uploading the new version. On the
                                                        other hand if you change anything in a template it will not affect the
                                                        appearance of your site until you upload recompiled versions of all the files
                                                        depending on that template. Furthermore, changes in the template will have no
                                                        effect on any thing which is in an editable region in the template. Once you
                                                        have generated a new page the only way you can change the contents of an
                                                        editable region is to go to the individual page and manually change all
                                                        instances of that object.

                                                        So CSS is an extremely powerful tool for controlling the style of your web site,
                                                        but unfortunately it uses a complex and somewhat arcane set of rules. It
                                                        renames some parameters ('padding' instead of 'cellpadding'), and omits others
                                                        (like 'cellspacing') completely. It also seems to introduce unnecessary
                                                        complexity (I can see little reason for the distinction between 'id' and
                                                        'class').

                                                        The designers have gone to a lot of trouble to enable you to do some things
                                                        better, but they appear to have overlooked others completely. If they had
                                                        introduced constants at the start of their project, they could have made their
                                                        life simpler, and enabled the users to fill in the holes. For example if
                                                        anything starting with 'c_...' were a constant we could have the following
                                                        definition in the CSS file:

                                                        C_cellsp: 6px; c_bdr: 4px; c_bdrclr: #ff0000; c_bgclr: #f0f0f8;

                                                        And on the individual pages the table definition could be:
                                                        <table width="25%" border="c_bdr" bordercolor=" c_bdrclr " align="right"
                                                        cellpadding="10" cellspacing="c_cellsp" bgcolor="c_bgclr">

                                                        This would have provided a very simple, but extremely powerful way of
                                                        controlling anything we liked on our web site from the CSS file.

                                                        (And CSS does have some predefined constants; purple and maroon for example.)


                                                        Clancy@cybec.com.au
                                                        • 25. Re: Defining constants
                                                          Level 7
                                                          Clancy wrote:
                                                          > The single biggest virtue of using CSS is that anything defined in the CSS file
                                                          > affects the whole of your site, and you can immediately change any property it
                                                          > defines simply by changing the CSS file and uploading the new version. On the
                                                          > other hand if you change anything in a template it will not affect the
                                                          > appearance of your site until you upload recompiled versions of all the files
                                                          > depending on that template. Furthermore, changes in the template will have no
                                                          > effect on any thing which is in an editable region in the template. Once you
                                                          > have generated a new page the only way you can change the contents of an
                                                          > editable region is to go to the individual page and manually change all
                                                          > instances of that object.
                                                          >
                                                          >
                                                          > The designers have gone to a lot of trouble to enable you to do some things
                                                          > better, but they appear to have overlooked others completely. If they had
                                                          > introduced constants at the start of their project, they could have made their
                                                          > life simpler, and enabled the users to fill in the holes. For example if
                                                          > anything starting with 'c_...' were a constant we could have the following
                                                          > definition in the CSS file:
                                                          >
                                                          > C_cellsp: 6px; c_bdr: 4px; c_bdrclr: #ff0000; c_bgclr: #f0f0f8;
                                                          >
                                                          > And on the individual pages the table definition could be:
                                                          > <table width="25%" border="c_bdr" bordercolor=" c_bdrclr " align="right"
                                                          > cellpadding="10" cellspacing="c_cellsp" bgcolor="c_bgclr">
                                                          >
                                                          > This would have provided a very simple, but extremely powerful way of
                                                          > controlling anything we liked on our web site from the CSS file.
                                                          >

                                                          What you are proposing here is more complicated than simply using
                                                          properly understood CSS.


                                                          I think you are confusing two things that are like apples and oranges.

                                                          Templates: Control the content of the pages. Uneditable: appears on
                                                          every page. Editable: can be modified for every page.

                                                          CSS: Control the layout/styling of the page.

                                                          What you refer to as "constants" already exist in CSS, only in a
                                                          structural way. For instance, if your page layout exists of 4 regions,
                                                          a header, a left column for navigation, a right, wider column for
                                                          content, and a footer, you can assign IDs to these regions and define
                                                          unique css styles to each of them.

                                                          If you want certain styles to be "inherited" throughout the page, you
                                                          can design your css accordingly, as long as you understand the cascade
                                                          and inheritance.

                                                          "So CSS is an extremely powerful tool for controlling the style of your
                                                          web site, but unfortunately it uses a complex and somewhat arcane set of
                                                          rules. It renames some parameters ('padding' instead of 'cellpadding'),
                                                          and omits others (like 'cellspacing') completely."

                                                          As to this, it is nonsense. cellspacing and cellpadding are deprecated
                                                          html that are to be avoided by using CSS instead. Padding and margins
                                                          can be applied to many html elements, not just tables and cells.
                                                          Cellspacing would be redundant, as would paragraphspacing,
                                                          bodyspacing,or imageborder.

                                                          "It also seems to introduce unnecessary complexity (I can see little
                                                          reason for the distinction between 'id' and 'class')."

                                                          That's because you don't **understand** the distinction. In my example
                                                          above, for instance, the ID, which can only be used once per page,
                                                          uniquely identifies a structural element of the page (e.g., the column
                                                          containing the navigation buttons). I would use a class, on the other
                                                          hand, to identify an element that is to be treated specially on more
                                                          than one occasion on the page. For instance, if I wanted for some
                                                          reason to have a "normal" paragraph print in blue, but certain "special"
                                                          paragraphs to print in red, I could define the class of special
                                                          paragraph and mark those paragraphs <p class="special">



                                                          --
                                                          Bonnie in California
                                                          kroko at
                                                          pixelplum dot com
                                                          http://www.theanimalrescuesite.com/cgi-bin/WebObjects/CTDSites.woa
                                                          • 26. Re: Defining constants
                                                            Level 7
                                                            On Tue, 23 May 2006 11:01:24 +1000, Clancy <clancy@cybec.com.au> wrote:

                                                            >The single biggest virtue of using CSS is that anything defined in the CSS file
                                                            >affects the whole of your site, and you can immediately change any property it
                                                            >defines simply by changing the CSS file and uploading the new version. On the
                                                            >other hand if you change anything in a template it will not affect the
                                                            >appearance of your site until you upload recompiled versions of all the files
                                                            >depending on that template.

                                                            Web pages, nor style sheets are compiled. It appears that you're
                                                            approaching the medium with a programming background and this isn't
                                                            programming. Programming is involved in things like server side
                                                            scripting, but not in the finished pages sent to the browser, with the
                                                            exception of some client side JavaScript. Web page construction is a
                                                            different paradigm completely.


                                                            >Furthermore, changes in the template will have no
                                                            >effect on any thing which is in an editable region in the template. Once you
                                                            >have generated a new page the only way you can change the contents of an
                                                            >editable region is to go to the individual page and manually change all
                                                            >instances of that object.

                                                            HTML defined document structure and CSS defines the manner in which
                                                            various elements are styled. A template is used to define certain parts
                                                            of all pages that will be the same. You insert editable regions in a
                                                            template to allow for unique content on the different pages built from
                                                            that template. Again, we're talking here about *content*, not styling.


                                                            >So CSS is an extremely powerful tool for controlling the style of your web site,
                                                            >but unfortunately it uses a complex and somewhat arcane set of rules. It
                                                            >renames some parameters ('padding' instead of 'cellpadding'), and omits others
                                                            >(like 'cellspacing') completely.

                                                            But padding applies to other elements besides just table cells. Using
                                                            the padding property is much more intuitive than having to remember that
                                                            table cells use "cellpadding" and everything else just uses padding.


                                                            >t also seems to introduce unnecessary
                                                            >complexity (I can see little reason for the distinction between 'id' and
                                                            >'class').

                                                            That's because you don't really have a thorough understanding of CSS. An
                                                            ID refers to one specific object on a page. A class can be used many
                                                            times in a page. Because of that, an ID carries a higher specificity and
                                                            can be used to override conflicting styles in a class.


                                                            >The designers have gone to a lot of trouble to enable you to do some things
                                                            >better, but they appear to have overlooked others completely. If they had
                                                            >introduced constants at the start of their project, they could have made their
                                                            >life simpler, and enabled the users to fill in the holes. For example if
                                                            >anything starting with 'c_...' were a constant we could have the following
                                                            >definition in the CSS file:
                                                            >
                                                            >C_cellsp: 6px; c_bdr: 4px; c_bdrclr: #ff0000; c_bgclr: #f0f0f8;
                                                            >
                                                            >And on the individual pages the table definition could be:
                                                            ><table width="25%" border="c_bdr" bordercolor=" c_bdrclr " align="right"
                                                            >cellpadding="10" cellspacing="c_cellsp" bgcolor="c_bgclr">

                                                            Of course you're not using CSS at all there. You're using invalid HTML.
                                                            There's no such attribute as "bordercolor" and you're using deprecated
                                                            HTML attributes instead of CSS for styling the table. Why not this?

                                                            CSS:

                                                            .foo{
                                                            background-color: #f0f0f8;
                                                            border-spacing: 6px;
                                                            float: right;
                                                            width: 25%;
                                                            }
                                                            .foo td{
                                                            border: 4px solid #f00;
                                                            padding: 4px;
                                                            }

                                                            HTML:

                                                            <table class="foo">

                                                            Now, I'll give you the fact that browser support for the border-spacing
                                                            property is pretty weak. That's not a problem with CSS; it's a problem
                                                            with the way browsers support (or fail to support) it.

                                                            Gary