Wrox Programmer Forums
|
BOOK: Beginning Web Programming with HTML, XHTML, and CSS This forum is for discussing Jon Duckett's book Beginning Web Programming with HTML, XHTML, and CSS.
Welcome to the p2p.wrox.com Forums.

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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 30th, 2007, 02:54 PM
Registered User
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default CSS, External Style sheets

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
 
Old March 31st, 2007, 01:48 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

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.

--

Joe (Microsoft MVP - XML)
 
Old March 31st, 2007, 03:28 AM
Registered User
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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; }

h1 {font-size:18pt;}

p {font-size:12pt;}

table {
   background-color:#efefef;
   border-style:solid;
   border-width:1px;
   border-color:#999999;}

th {
   background-color:#cccccc;
   font-weight:bold;
   padding:5px;}

td {padding:5px;}

td.code {
   font-family:courier, courier-new, serif;
   font-weight:bold;}
</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>

Regards Tony

 
Old March 2nd, 2009, 04:52 PM
Registered User
 
Join Date: Mar 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Angry CSS sheets for the book

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?
 
Old March 3rd, 2009, 08:36 AM
jminatel's Avatar
Wrox Staff
Points: 18,059, Level: 58
Points: 18,059, Level: 58 Points: 18,059, Level: 58 Points: 18,059, Level: 58
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2003
Posts: 1,906
Thanks: 62
Thanked 139 Times in 101 Posts
Default

Regarding the different chapter numbers in the book, is it possible that you have the 2nd edition:
http://www.wrox.com/WileyCDA/WroxTit...470259310.html
You're in the forum for the first edition. The 2nd edition forum if that's what you need is here:
http://p2p.wrox.com/book-beginning-w...0-25931-3-399/
and the code is here:
http://www.wrox.com/WileyCDA/WroxTit...-DOWNLOAD.html
If this isn't the issue let us know and we'll keep trying to help.
__________________
Jim Minatel
Associate Publisher, WROX - A Wiley Brand
Did someone here help you? Click on their post!
 
Old April 7th, 2010, 01:04 PM
Registered User
 
Join Date: Apr 2010
Posts: 70
Thanks: 4
Thanked 0 Times in 0 Posts
Default

It should look like this:

Code:
<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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Style sheets & Menus arnabghosh Dreamweaver (all versions) 1 October 27th, 2005 04:09 PM
Dynamically adding style sheets ? Xnera ASP.NET 1.0 and 1.1 Basics 1 August 21st, 2003 06:40 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.