Forum Moderators: not2easy
Am I supposed to specify fonts within the commands somehow, such as <ol font="arial">? The bullets themselves use the default font.
I know this is such a simple, basic question, and I do feel silly asking it.
I always validate my site, so I know it's structurally sound, so why is this happening?
Any help would be great.
If not, your problem is in your style sheet. Look very carefully at your style sheet.
Test locally, comment-out parts of your style sheet until the problem goes away.
Here is my sheet:
A.NAVI:link {
background-color : #99ccff;
color : black;
font-family : arial, sans-serif;
font-size : 10pt;
text-decoration : none;
}
A.NAVI:visited {
background-color : #99ccff;
color : black;
font-family : arial, sans-serif;
font-size : 10pt;
text-decoration : none;
}
A.NAVI:hover {
background-color : #99ccff;
color : #ffffff;
font-family : arial, sans-serif;
font-size : 10pt;
text-decoration : underline;
}
A.NAVI:active {
background-color : #99ccff;
color : black;
font-family : arial, sans-serif;
font-size : 10pt;
text-decoration : none;
}
P.NAVI {
background-color : #99ccff;
color : black;
font-family : arial, sans-serif;
font-size : 10pt;
}
A.TITLE:link {
background-color : #ffffff;
color : blue;
font-family : arial, sans-serif;
font-size : 10pt;
font-weight : bold;
text-decoration : none;
}
A.TITLE:visited {
background-color : #ffffff;
color : black;
font-family : arial, sans-serif;
font-size : 10pt;
font-weight : bold;
text-decoration : none;
}
A.TITLE:hover {
background-color : #ffffff;
color : black;
font-family : arial, sans-serif;
font-size : 10pt;
font-weight : bold;
text-decoration : underline;
}
A.TITLE:active {
background-color : #ffffff;
color : red;
font-family : arial, sans-serif;
font-size : 10pt;
font-weight : bold;
text-decoration : none;
}
A.ARTICLE:link {
background-color : #ffffff;
color : red;
font-family : arial, sans-serif;
font-size : 10pt;
text-decoration : underline;
}
A.ARTICLE:visited {
background-color : #ffffff;
color : blue;
font-family : arial, sans-serif;
font-size : 10pt;
text-decoration : underline;
}
A.ARTICLE:hover {
background-color : #ffffff;
color : black;
font-family : arial, sans-serif;
font-size : 10pt;
text-decoration : none;
}
A.ARTICLE:active {
background-color : #ffffff;
color : red;
font-family : arial, sans-serif;
font-size : 10pt;
text-decoration : none;
}
P.DESCR:first-line {
background-color : #ffffff;
color : black;
font-family : arial, sans-serif;
font-size : 12pt;
font-weight : bold;
}
P.DESCR {
background-color : #ffffff;
color : black;
font-family : arial, sans-serif;
font-size : 10pt;
}
P.DATE {
background-color : #ffffff;
color : black;
font-family : arial, sans-serif;
font-size : 10pt;
font-style : italic;
}
P.ARTICLE {
background-color : #ffffff;
color : black;
font-family : arial, sans-serif;
font-size : 10pt;
}
P.TVALERT {
background-color : yellow;
color : black;
font-family : arial, sans-serif;
font-size : 10pt;
font-weight : bold;
text-align : center;
}
You don't have a selector for lists or list elements. Nor do you have a selector for BODY. You haven't specified either a default font for the document nor for lists or list elements. So, your lists are going to take the browser default font.
Lists don't embed in paragraphs. I think that the the fatal misconception. Lists start a new top-level block. Lists are peers with paragraphs, block-wise. (Lists, like anything else, embed in divisions, though.)
You've exhaustively given a font for each selector. This is unnecessary and adds bloat to your style sheet. You listed the same fonts almost 20 times.
Why not give a default font to your entire document, using a BODY selector? Then, specify fonts for anything that is DIFFERENT from the document default. Ditto for colors. Give a default color for BODY. Then give colors for anything that is different.
(Right now, there ARE no different fonts, so just specify the fonts for BODY and be done with it...)
Did you validate your HTML as well? If you are using <p> tags with no </p> then it would validate. (Assuming an appropriate DTD for that style.) But again, validation doesn't mean it will read your mind and do what you want it to do. The appearence of an <ol>, <ul>, etc. tag ends any previous <p> block. That was a paragraph, this is a list. Mutually-exclusive.
If you are using <p>text</p> and have tried to embed lists inside paragraphs, it should have failed HTML validation.
Here is the new body command I've implemented. What's strange is that the font style and color affect the whole document, but when it comes to size, the <ol> or <ul> commands still use the default size -- completely ignoring the size command.
BODY,P
{background-color: #FFFFFF;
color: black;
font-family: arial, sans-serif;
font-size: 10pt;
text-decoration: none}
What am I doing wrong?
Thanks again.
Have you looked at the HTML to make sure there is no additional styles in there?
As an aside that's a very wordy CSS - as jtara points out you are repeating stuff unnecessarily for multiple selectors. Basicaly, once you have stated that 'a' is to have a given style, you only need to mention it again if there is some variation from that basic style.
You have defined font size and family for 'body', so you don't need to repeat that.
This:
A.NAVI:link {
background-color : #99ccff;
color : black;
font-family : arial, sans-serif;
font-size : 10pt;
text-decoration : none;
}
A.NAVI:visited {
background-color : #99ccff;
color : black;
font-family : arial, sans-serif;
font-size : 10pt;
text-decoration : none;
}
A.NAVI:hover {
background-color : #99ccff;
color : #ffffff;
font-family : arial, sans-serif;
font-size : 10pt;
text-decoration : underline;
}
A.NAVI:active {
background-color : #99ccff;
color : black;
font-family : arial, sans-serif;
font-size : 10pt;
text-decoration : none;
}
A.TITLE:link {
background-color : #ffffff;
color : blue;
font-family : arial, sans-serif;
font-size : 10pt;
font-weight : bold;
text-decoration : none;
}
A.TITLE:visited {
background-color : #ffffff;
color : black;
font-family : arial, sans-serif;
font-size : 10pt;
font-weight : bold;
text-decoration : none;
}
A.TITLE:hover {
background-color : #ffffff;
color : black;
font-family : arial, sans-serif;
font-size : 10pt;
font-weight : bold;
text-decoration : underline;
}
A.TITLE:active {
background-color : #ffffff;
color : red;
font-family : arial, sans-serif;
font-size : 10pt;
font-weight : bold;
text-decoration : none;
}
A.ARTICLE:link {
background-color : #ffffff;
color : red;
font-family : arial, sans-serif;
font-size : 10pt;
text-decoration : underline;
}
A.ARTICLE:visited {
background-color : #ffffff;
color : blue;
font-family : arial, sans-serif;
font-size : 10pt;
text-decoration : underline;
}
A.ARTICLE:hover {
background-color : #ffffff;
color : black;
font-family : arial, sans-serif;
font-size : 10pt;
text-decoration : none;
}
A.ARTICLE:active {
background-color : #ffffff;
color : red;
font-family : arial, sans-serif;
font-size : 10pt;
text-decoration : none;
}
could easily be reduced to this (or less):
a {text-decoration:none;}
a:hover {text-decoration:underline;}
A.NAVI {
background-color : #99ccff;
color : black;
}
A.TITLE:link {
color : blue;
}
A.TITLE:visited {
color : black;
}
A.TITLE:hover {
color : black;
}
A.TITLE:active {
color : red;
}
A.ARTICLE:link {
color : red;
text-decoration : underline;
}
A.ARTICLE:visited {
color : blue;
text-decoration : underline;
}
A.ARTICLE:hover {
color : black;
text-decoration : none;
}
BODY,P,OL,UL
{background-color: #FFFFFF;
color: black;
font-family: arial, sans-serif;
font-size: 10pt;
text-decoration: none}
and it works, until the list command ends. After it ends, it changes back to the browser default size, and I think I know why: I use forms to input my data, and one of the commands I have in the insert_db file for my form is the following:
$myarticle = str_replace(Chr(13),'<br>', $article);
Since that break command is in place of the <p> command, I would presume that is why the text beneath the list command is not obeying the size command. Am I right?
If so, how can I work around it so that this won't happen? I would like to leave the <br> command as it is.
If not, what else could it be?
If I use <p> after the list command, the font size adheres to the command in the body sheet; but my form uses <br><br> (instead of one <p>), which changes the size of the font to the browser default.
Maybe an illustration would help. Part of my page looks something like this:
<td>
-<p>
---<br>
---<br>
---<br>
---<br>
-----<ol>
-------<li>
-------<li>
-----</ol>
---<br> <-- This is where the font size begins to change.
---<br>
---<br>
---<br>
</td>
Any advice?
<ol> closes the preceeding paragraph. This is because the closing </p> is optional in HTML and a paragraph cannot contain a list. So this means that the text following your
</ol> is not within the paragraph or any other block-level element other than the table cell itself. This means that styles applied just to the pagagraph won't affect this text. You need to re-open a new paragraph for text after the list.