Current location: Hot Scripts Forums » General Web Coding » CSS » browser only renders font size change, no color, etc.


browser only renders font size change, no color, etc.

Reply
  #1 (permalink)  
Old 02-14-09, 05:55 PM
labelle labelle is offline
New Member
 
Join Date: Feb 2009
Location: Iowa
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
browser only renders font size change, no color, etc.

I'm just learning how to use css and have run into a problem:

The browser seems to be using my css to determine the font size, but nothing else (i.e. text color, font, style).

Also, I can't edit the font size. Once I have opened the page with x font size, if I change the font size, save both the css and html, and refresh the page, the size does not change. I can, however, use a new selector on different text in the html document. I can also change the selector of the original text, reload the page (and it will adjust the font size appropriately), and change it back to the original selector (with different font size), which it will render the correct size.

I am using Firefox, but it does the same thing in IE. I originally thought it was a problem with refreshing the page, but I cleared the cache and that didn't make a difference. I don't have any other tags that would specify font attributes and thus override the H1 tag (see below).

This is what's in my <head> tags:

<title>Title</title>
<STYLE TYPE="text/css">
<LINK REL=STYLESHEET HREF="isufcstyles.css" TYPE="text/css">
</STYLE>


This is what's in my external style sheet:

H1
{
font-family:sans-serif;
font-size:40pt;
font-style:italic;
color:white;
}


This is what's in the html document:

<H1>texttexttext</H1>

The above text is rendered in 40pt font, but it is my default Times New Roman, black, and not italic.

There's probably some fairly obvious error, but I've been staring at the page too long to be able to find it at this point. Any help would be appreciated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 02-15-09, 04:12 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
Do it like this:

isufcstyles.css
CSS Code:
  1. body{background:#000;}
  2. H1
  3. {
  4. font-family:sans-serif;
  5. font-size:40pt;
  6. font-style:italic;
  7. color:white;
  8. }

index.html
HTML Code:
<html>
<head>
<title>Title</title>
<LINK REL=STYLESHEET HREF="isufcstyles.css" TYPE="text/css">
</head>
<body>
<H1>texttexttext</H1>
</body>
</html>
__________________
Jerry Broughton

Last edited by job0107; 02-15-09 at 04:15 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 03-20-09, 05:54 PM
labelle labelle is offline
New Member
 
Join Date: Feb 2009
Location: Iowa
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks! Taking out the style tags fixed it. Not even sure why I had those in there to begin with...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 03-30-09, 02:41 AM
mk456's Avatar
mk456 mk456 is offline
Newbie Coder
 
Join Date: Jan 2009
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
This attribute has been deprecated in favor of style sheets for specifying background color information.
1.Alignment


It is possible to align block elements (tables, images, objects, paragraphs, etc.) on the canvas with the align attribute. Although this attribute may be set for many HTML elements, its range of possible values sometimes differs from element to element. Here we only discuss the meaning of the align attribute for text.

Attribute definitions

align = left|center|right|justify [CI]
Deprecated. This attribute specifies the horizontal alignment of its element with respect to the surrounding context. Possible values:

* left: text lines are rendered flush left.
* center: text lines are centered.
* right: text lines are rendered flush right.
* justify: text lines are justified to both margins.

The default depends on the base text direction. For left to right text, the default is align=left, while for right to left text, the default is align=right.

DEPRECATED EXAMPLE:
This example centers a heading on the canvas.

<H1 align="center"> How to Carve Wood </H1>

Using CSS, for example, you could achieve the same effect as follows:

<HEAD>
<TITLE>How to Carve Wood</TITLE>
<STYLE type="text/css">
H1 { text-align: center}
</STYLE>
<BODY>
<H1> How to Carve Wood </H1>

Note that this would center all H1 declarations. You could reduce the scope of the style by setting the class attribute on the element:

<HEAD>
<TITLE>How to Carve Wood</TITLE>
<STYLE type="text/css">
H1.wood {text-align: center}
</STYLE>
<BODY>
<H1 class="wood"> How to Carve Wood </H1>

DEPRECATED EXAMPLE:
Similarly, to right align a paragraph on the canvas with HTML's align attribute you could have:

<P align="right">...Lots of paragraph text...

which, with CSS, would be:

<HEAD>
<TITLE>How to Carve Wood</TITLE>
<STYLE type="text/css">
P.mypar {text-align: right}
</STYLE>
<BODY>
<P class="mypar">...Lots of paragraph text...

DEPRECATED EXAMPLE:
To right align a series of paragraphs, group them with the DIV element:

<DIV align="right">
<P>...text in first paragraph...
<P>...text in second paragraph...
<P>...text in third paragraph...
</DIV>

With CSS, the text-align property is inherited from the parent element, you can therefore use:

<HEAD>
<TITLE>How to Carve Wood</TITLE>
<STYLE type="text/css">
DIV.mypars {text-align: right}
</STYLE>
<BODY>
<DIV class="mypars">
<P>...text in first paragraph...
<P>...text in second paragraph...
<P>...text in third paragraph...
</DIV>

To center the entire document with CSS:

<HEAD>
<TITLE>How to Carve Wood</TITLE>
<STYLE type="text/css">
BODY {text-align: center}
</STYLE>
<BODY>
...the body is centered...
</BODY>

The CENTER element is exactly equivalent to specifying the DIV element with the align attribute set to "center". The CENTER element is deprecated.
15.1.3 Floating objects

Images and objects may appear directly "in-line" or may be floated to one side of the page, temporarily altering the margins of text that may flow on either side of the object.
Float an object

The align attribute for objects, images, tables, frames, etc., causes the object to float to the left or right margin. Floating objects generally begin a new line. This attribute takes the following values:

* left: Floats the object to the current left margin. Subsequent text flows along the image's right side.
* right: Floats the object to the current right margin. Subsequent text flows along the image's left side.

DEPRECATED EXAMPLE:
The following example shows how to float an IMG element to the current left margin of the canvas.

<IMG align="left" src="http://foo.com/animage.gif" alt="my boat">

Some alignment attributes also permit the "center" value, which does not cause floating, but centers the object within the current margins. However, for P and DIV, the value "center" causes the contents of the element to be centered.
Float text around an object

Another attribute, defined for the BR element, controls text flow around floating objects.

Attribute definitions

clear = none|left|right|all [CI]
Deprecated. Specifies where the next line should appear in a visual browser after the line break caused by this element. This attribute takes into account floating objects (images, tables, etc.). Possible values:

* none: The next line will begin normally. This is the default value.
* left: The next line will begin at nearest line below any floating objects on the left-hand margin.
* right: The next line will begin at nearest line below any floating objects on the right-hand margin.
* all: The next line will begin at nearest line below any floating objects on either margin.

Consider the following visual scenario, where text flows to the right of an image until a line is broken by a BR:

********* -------
| | -------
| image | --<BR>
| |
*********

If the clear attribute is set to none, the line following BR will begin immediately below it at the right margin of the image:

********* -------
| | -------
| image | --<BR>
| | ------
*********

DEPRECATED EXAMPLE:
If the clear attribute is set to left or all, the next line will appear as follows:

********* -------
| | -------
| image | --<BR clear="left">
| |
*********
-----------------

Using style sheets, you could specify that all line breaks should behave this way for objects (images, tables, etc.) floating against the left margin. With CSS, you could achieve this as follows:

<STYLE type="text/css">
BR { clear: left }
</STYLE>

To specify this behavior for a specific instance of the BR element, you could combine style information and the id attribute:

<HEAD>
...
<STYLE type="text/css">
BR#mybr { clear: left }
</STYLE>
</HEAD>
<BODY>
<P>...
********* -------
| | -------
| table | --<BR id="mybr">
| |
*********
-----------------
...
</BODY>

15.2 Fonts

The following HTML elements specify font information. Although they are not all deprecated, their use is discouraged in favor of style sheets.
15.2.1 Font style elements: the TT, I, B, BIG, SMALL, STRIKE, S, and U elements

<!ENTITY % fontstyle
"TT | I | B | BIG | SMALL">
<!ELEMENT (%fontstyle;|%phrase - - (%inline*>
<!ATTLIST (%fontstyle;|%phrase


I hpope it will work for you......................................
__________________
Website Traffic
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Readfile Font Size ChrisXPPro PHP 6 11-09-07 06:15 PM
Looking for a script that will allow users to change the font size AND family AshleyQuick Script Requests 1 03-18-07 02:35 PM
Font Size Scaling / AutoScale mike_wilson Windows .NET Programming 0 05-13-05 11:33 AM
gd font size limit? jasong PHP 2 06-06-04 03:58 PM
font size on IE resize b0yakk HTML/XHTML/XML 7 02-22-04 12:20 PM


All times are GMT -5. The time now is 10:29 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.