homepage Welcome to WebmasterWorld Guest from 54.163.91.250
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Basic CSS/HTML StyleSheet Linking Trouble Shooting HElp?
jeckvishva




msg:4349710
 11:53 pm on Aug 9, 2011 (gmt 0)

Basic CSS/HTML StyleSheet Linking Trouble Shooting Please Help?

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//WSC//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-


<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>CSS Example</title>

<link rel="stylesheet" type="text/css" href="stylesheetcss.css" />
</head>
<body>
<h1> Basic CSS Font Properties</h1>
<p>The following table shows you the basic CSS font properties that allow
you to change the appearance of text in your documents.</p>

<table>
<tr>
<th>Property</th>
<th>Purpose</th>
</tr>
<tr>
<td class="code">font-family</td>
<td>Specifies the font used</td>
</tr>
<tr>
<td class="code">font-size</td>
<td>Specifies the size of the font used</td>
</tr>
<tr>
<td class="code">font-style</td>
<td>Specifies whether the font should be normal, italic or oblique</td>
</tr>
<tr>
<td class="code">font-weight</td>
<td>Specifies whether the font should be normal, bold, bolder, or lighter</td>
</tr>
</table>
</body>
</html>

And for my Style Sheet I have this but its not working and its in the same directory




body {

color:ffefd5;
background-color:3cb371;
font-family:arial, verdana, sans-serif; }

h1 {font-size:30pt;}





For some reason on the .html page the second row for my tables is not showing up and whateve I do cant fix it plus my CSS is not linking up and ive tried many things to no avail could someone please point me in the right direction

 

penders




msg:4349725
 12:46 am on Aug 10, 2011 (gmt 0)

body { 
color: #ffefd5;
background-color:
#3cb371;
font-family: arial, verdana, sans-serif;
}


You need '#' before the color values.

lucy24




msg:4349737
 12:57 am on Aug 10, 2011 (gmt 0)

Start with the embarrassingly obvious. Is your stylesheet in fact named stylesheetcss.css ? Is it only the color names that aren't coming through, or also the other properties? What about the rest of the CSS? You've got a class = "code" that you didn't include in your example.

Color names in the format you've used need a leading # or they will not be recognized.

Most important: Your DTD is in the wrong form. Feed it into the validator as a direct paste-in (I filled in the missing line as ... "DTD/xhtml1-strict.dtd"> ) and it will spit out 30 errors, most of them fixable by a single change.

Throw out the xml line, which you don't need, and replace the next few lines with

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns = "http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv = "Content-Type" content = "text/html; charset=UTF-8" />

and the validator will be much happier.

When you say "second row" do you mean the first non-header row, or the second row of ordinary cells? Does it do this in all browsers?

g1smd




msg:4349827
 5:47 am on Aug 10, 2011 (gmt 0)

Also, don't use relative page links to your stylesheet, use root relative or absolute URLs.

That is, begin the link with a leading slash and specify the full path to the file, or begin the link with http and specify the domain name and full path to the file.

You'll appreciate why this is important once you start to use URL rewriting for HTML pages.

rocknbil




msg:4350000
 5:06 pm on Aug 10, 2011 (gmt 0)

Is this what's actually in the document?

<!DOCTYPE html PUBLIC "-//WSC//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-

It's an incomplete document declaration. Should be

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Don't know why that would have any effect on the table rows, they look fine.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved