Forum Moderators: not2easy
THANKS!
.left {
background: #FCDB8C;
color: #000000;
border: 1px solid #000000;
}
.middle {
background: #EFBE00;
background-image: url('images/cell1.gif');
color: #000000;
border-top: 1px solid #000000;
border-bottom: 1px solid #000000;
}
.mainbody {
background: #FFFFFF;
color: #000000;
border: 1px solid #000000;
padding: 15px;
text-align: justify;
}
.navigation {
background: #FFFFFF;
color: #000000;
border: 1px solid #000000;
text-align: center;
}
.copyright {
color: #000000;
font-size: 85%;
letter-spacing: 2;
font-weight: bold;
padding: 2px;
text-align: center
}
.hottopic {
border: 1px solid #000000;
padding: 5px;
font-size: 80%;
text-align: left;
background: #B9C4E4;
color: #000000;
}
.form {
border: 1px solid #000000;
background: #95A2CE;
color: #000000;
letter-spacing: 2;
font-weight-bold
}
so you are saying that is not necessary, it's just an author created (author's word choice) class name?
it could be (and have the same effect as long as it is referred to in the same places in the html) ?:
myclassName {
background: #FCDB8C;
color: #000000;
border: 1px solid #000000;
}
.myclassName2 {
background: #EFBE00;
background-image: url('images/cell1.gif');
color: #000000;
border-top: 1px solid #000000;
border-bottom: 1px solid #000000;
}
etc....? in short the dots are not required by any spec. ?
are the dots required? or can it be: pfirst{ color: blue; }
psecond{ color: red; }
are there alternatives to the "dot" in the above example or is this actually spec?
You can also omit the tag name in the selector to define a style that will be used by all HTML elements that have a certain class. In the example below, all HTML elements with class="center" will be center-aligned:
.center {text-align:center}
In the code below both the h1 element and the p element have class="center". This means that both elements will follow the rules in the ".center" selector:
<h1 class="center">This heading will be center-aligned</h1>
<p class="center">This paragraph will also be center-aligned.</p>[w3schools.com...]
?
[edited by: tedster at 3:28 am (utc) on April 25, 2009]
[edit reason] attribute the quote [/edit]
p = styles all paragraphs. .name = styles all stuff that has class name of "name", could be a div, h1, p, li, img, or anything at all. p.name = styles only paragraphs with class name of "name". Does not style other elements (ul, h1, img, etc) with the same class name. Does not style paragraphs with a different class name.
p {...} applies to <p> elements
.p {...} applies to all elements with with class "p" eg <p class="p">, <h1 class="p">, <i class="p"> etc
p.p {...} applies to all <p> elements with class "p" i.e. <p class="p"> but doesn't apply to <h1 class="p">, <i class="p"> etc
#p {...} applies to a single element with an ID of "p" eg <p id="p"> or <h1 id="p"> or <i id="p"> etc.
CSS Crash Course - Font Control and Basic Syntax [webmasterworld.com]
you can use actual html elements ()no added symbol(s) necessary, e.g. dot) in the element name on an *external style sheet (and without referring to them in the html]; and, you can also create CSS classes in an *external style sheet, named whatever you like, preceded by a dot (then refer to them in the html).
(*some of this, not all, also pertains to block or in-line CSS.)
- in an external CSS file (advantage: one file styles the whole site, easy to maintain, whole site is consistent, file is cached so it will load once per visit not once per page view)
- in the HEAD section of each page (disadvantage: hard to maintain, makes page load slower) - OK for single item that applies to ONLY one page {but still not recommended}.
- inline on the HTML element itself (disadvantage: code bloat; impossible to maintain) - just don't do it.
.
Another thing. if you find yourself repeating the same class name over and over in the HTML, change the code so that the class name goes on the parent container, and then style it using the parent child { .... } notation.
That is, change the HTML from:
<div>
<p [b]class="name"[/b]>Text goes here.</p>
<p [b]class="name"[/b]>Text goes here.</p>
<p [b]class="name"[/b]>Text goes here.</p>
<p [b]class="name"[/b]>Text goes here.</p>
<p [b]class="name"[/b]>Text goes here.</p>
<p [b]class="name"[/b]>Text goes here.</p>
</div> to:
<div [b]class="name"[/b]>
<p>Text goes here.</p>
<p>Text goes here.</p>
<p>Text goes here.</p>
<p>Text goes here.</p>
<p>Text goes here.</p>
<p>Text goes here.</p>
</div> and change the CSS from:
[b]p.[/b]nam[b]e {[/b] ... } to:
[b]div.[/b]nam[b]e p {[/b] ... } Notice the space between
div.name and p here.
THANKS
btw, any suggestions/tips on stripping down and site that does have an external sheet but is nevertheless bloated in the html?
this site:
<snip>
recently i was asked this about that site:
"And, if you can do it easily, can we adjust the fonts on the home page titles so that they are all uniform in size? Bigger than the small titles, but smaller than the large titles."
not quite sure what she specifically means yet. maybe you see it?
[edited by: swa66 at 5:06 pm (utc) on April 23, 2009]
[edit reason] No URLs, no site reviews please see ToS and forum charter [/edit]
<snip>
don't want to break any rules so i'm just asking .
[edited by: swa66 at 11:58 pm (utc) on April 23, 2009]
[edit reason] Keep discussions in the forum please. [/edit]