Cascading Style Sheets in XHTML 1.0 STRICT

  • #1
312
0

Main Question or Discussion Point

I am creating a webpage that is located on a server, where the parent directory is called public_html. In this directory, I have the file called assign5A.html that will be the web page seen on the browser. This file utilizes another file located in a subdirectory- public_html/CSS- and is called mystyles.css.

I am trying to create a class called "body" which will encapsulate the entire body of the page. I am going to try to set the background color along with the text font and color. So in the beginning of the assign5A.html I have written the following (notice it is written in XHTML 1.0 strict):

<?xml version = "1.0" encoding="UTF-8"?>
<!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" xml:lang="en" lang="en">

<head>
<title>CS403 Spring 2009 Assignment 5</title>
<link type = "text/css" rel = "stylesheet" href = "CSS/mystyles.css" />
</head>

<body class = "body">
.
.
.
</body>
</html>


**This entire source code can be viewed at http://pubpages.unh.edu/~jmm42/assign5A.html** [Broken]
-----------------------------------------------------

Now in the file public_html/CSS/mystyles.css, I have written the following to specify the necessary changes(and I changed the permission to -rw-r--r--):

<!-- File includes rules to add presentation details to assign5A.html -->

.body {background-color: #0000FF;}
-----------------------------------------------------

I'm pretty sure I was told that in the CSS file I had to put a period character before the class name, with brackets following containing attribute properties inside it. Oh yea, I never understood what type, rel stood for in the code <link type = "text/css" rel = "stylesheet" href = "CSS/mystyles.css" />
 
Last edited by a moderator:

Answers and Replies

  • #2
18,142
7,647
You don't need to name the body tag. It's already unique and only used once. So get rid of the class attribute and delete the period in front of it in the css file.
 
  • #3
312
0
I tried it, doesn't seem to work. But I think you are correct, I'll play around with it.


Thanks a lot,


JL
 
  • #4
CRGreathouse
Science Advisor
Homework Helper
2,820
0
"rel" is the relationship between the current (XHTML) file and the linked file. In this case, the file is a style sheet, so it is coded rel="stylesheet".

Type gives the MIME type. Other types: text/plain, text/html, application/xhtml+xml, application/octet-stream, image/jpeg, image/png, etc.
 
  • #5
312
0
Thanks for the help guys. I found the solution to my problems.
 

Related Threads on Cascading Style Sheets in XHTML 1.0 STRICT

Replies
6
Views
4K
  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
2
Views
1K
  • Last Post
Replies
3
Views
3K
  • Last Post
Replies
2
Views
4K
Replies
3
Views
5K
Replies
2
Views
2K
Replies
15
Views
762
Replies
4
Views
794
Top