You are currently viewing the BOOK: Beginning Web Programming with HTML, XHTML, and CSS section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
I am reading Beginning Web Programming with HTMl,Xhtml and CSS. By Jon Duckett.
I am particularly Interested is CSS. (CHAPTER 9 in the above book) It mentions the advantages of External CSS Style sheets and the link element that is used to attach a style sheet to a document. At this stage I have become completely lost as I cannot find a way to attach an external style sheet to a document and produce the required page or Site.
in the book pages 267 to 270. A basic example, I have not been able to produce the figure 9-3 on page 269.
Can anybody help me?
Tony Hoefkens
Can you show some code? You just create a "link" element with a "rel" attribute of "stylesheet", a "type" attribute of "text/css" and an "href" attribute pointing to the external file. This URL is relative to the page containing the link so if you just put "styles.css" then it must be in the same folder as the web page. If that's all done correctly then perhaps your CSS file is mal-formed.
Thank you Joe, I think this is the code you asked to see.<?xml vervion="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"HTTP//WWW.W3.ORG/tr/XHTML11/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head>
<title>CSS Example</title>
<link rel="stylesheet" type="text/css" href="ch09_eg01.CSS" />
/* Style sheet for ch09_eg01.html */
body {
color:#000000;
background-color:#ffffff;
font-family:arial, verdana, sans-serif; }
<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>
Where can I find the stilesheets that are mentioned in the book? I can find the HTML code, but not the CSS's. Also, the chapternr.s in my book are different HowCome?
<html>
<head>
<title>Test</title>
<link rel="stylesheet" type="text/css" href="yourcssfile.css" />
</head>
<body>
Make sure that you specify where the stylesheet is located. For example:If your HTML code is located in a folder called Codes, and in Codes is another folder called CSS, where this style sheet is located, and the name of the style sheet is CSSstyle, the href will look like this: href="Codes/CSSstyle.css
__________________
"Genius is 1% inspiration and 99% perspiration"