Welcome to WebmasterWorld Guest from 23.20.241.155

Forum Moderators: incrediBILL

Message Too Old, No Replies

Basic CSS/HTML StyleSheet Linking Trouble Shooting HElp?

     
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
12:46 am on Aug 10, 2011 (gmt 0)

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



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


You need '#' before the color values.
12:57 am on Aug 10, 2011 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



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?
5:47 am on Aug 10, 2011 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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.
5:06 pm on Aug 10, 2011 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month