Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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 .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 30th, 2007, 02:54 PM
Registered User
 
Join Date: Mar 2007
Location: Bewdley, Worcs., United Kingdom.
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
Reply With Quote
  #2 (permalink)  
Old March 31st, 2007, 01:48 AM
joefawcett's Avatar
Wrox Author
Points: 9,712, Level: 42
Points: 9,712, Level: 42 Points: 9,712, Level: 42 Points: 9,712, Level: 42
Activity: 7%
Activity: 7% Activity: 7% Activity: 7%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,066
Thanks: 1
Thanked 36 Times in 35 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)
Reply With Quote
  #3 (permalink)  
Old March 31st, 2007, 03:28 AM
Registered User
 
Join Date: Mar 2007
Location: Bewdley, Worcs., United Kingdom.
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

Reply With Quote
  #4 (permalink)  
Old May 1st, 2007, 04:39 PM
Authorized User
 
Join Date: Mar 2007
Location: , , Netherlands.
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Very simple:

<link rel="stylesheet" type="text/css" href="yourcssfile.css" />

Also as the book says this practice has much more advantages to inline css.

_____________________________
http://freehosting1.net
Reply With Quote
  #5 (permalink)  
Old March 2nd, 2009, 03: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?
Reply With Quote
  #6 (permalink)  
Old March 3rd, 2009, 07:36 AM
jminatel's Avatar
Wrox Staff
Points: 13,449, Level: 50
Points: 13,449, Level: 50 Points: 13,449, Level: 50 Points: 13,449, Level: 50
Activity: 7%
Activity: 7% Activity: 7% Activity: 7%
 
Join Date: May 2003
Location: Indianapolis, IN, USA.
Posts: 1,829
Thanks: 52
Thanked 98 Times in 78 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
Wiley Technology Publishing
WROX Press
Blog: http://p2p.wrox.com/content/blogs/jminatel
Wrox online library: http://wrox.books24x7.com
Wrox on Twitter: http://twitter.com/wrox
Did someone here help you? Click on their post!
Reply With Quote
  #7 (permalink)  
Old April 7th, 2010, 01:04 PM
Registered User
 
Join Date: Apr 2010
Location: Planet Earth
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
__________________
"Genius is 1% inspiration and 99% perspiration"
Reply With Quote
Reply


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 Off
Pingbacks are On
Refbacks are Off

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



All times are GMT -4. The time now is 08:29 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.