Re: Global and Local Declarations

Giganews Newsgroups
Subject: Re: Global and Local Declarations
Posted by:  Thomas 'PointedEars' Lahn (PointedEa…@web.de)
Date: Mon, 14 Aug 2017

Mike Copeland wrote:

> [unreadable]
>    Specifically, each page's code had a "body" statement (in the
> "style" section) that looked like this:

*Had*?

>  body { margin: 0 150px 0 150px; font: Verdana; font-size: 1.5em;
>          color: white; background-image: url("bg-green-grass.jpg"); }

That is a _rule(set)_ containing declarations; not a statement.  CSS is
_not_ a programming language.

There is no “‘style’ section”.  If you mean

  <style …>
    …
  </style>

that is a `style` _element_ (and an [X]HTML document can contain *several*
of them).

>    The first line is the code common to all pages, and the "color" and
> "background" vary.  I tried to make the 2nd part code-local (e.g.
>  .opt { color: white; background-image: url("bg-green-grass.jpg"); }
> and moved the 1st portion to my common .CSS file:
>  .global    { margin: 0 150px 0 150px; font: Verdana; font-size:
> 1.5em; }
>    Furthermore, I tried several CSS names (e.g. ".global, .body, body")
> with no success.

The first two are _class selectors_, the second one is an _element
selector_; not (just) “CSS names”.

> Of course, I used the page code like this:

There are no “Web pages”.

>  <body class="global opt">
>  <body class="body opt">

Hopefully only one of them at a time.

> Also without success...
>    Is there something about the "body tag" and its specification that
> prohibits my doing this?

No, and there is no “body tag”.

However, user settings/stylesheets and browser extensions/add-ons can
override/disable author stylesheets.

> Am I missing some fundamental CSS/HTML rule here?

That is likely as ISTM that you have not learned the basics yet.

> […] Please advise.  TIA

http://validator.w3.org/>
http://jigsaw.w3.org/css-validator/>

http://www.w3.org/TR/html/>
http://www.w3.org/Style/CSS/>

http://catb.org/esr/faqs/smart-questions.html>

> ---
> This email has been checked for viruses by [spam] software. […]

This is not e-mail.  Please disable this at least for posting to Usenet.

PointedEars

--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
  -- from http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)

Replies

None

In response to

Global and Local Declarations posted by Mike Copeland on Mon, 31 Jul 2017