HTML/CSS Cascading Style Sheets in XHTML 1.0 STRICT

  • Thread starter Thread starter jeff1evesque
  • Start date Start date
AI Thread Summary
The discussion revolves around creating a webpage with XHTML 1.0 strict, specifically focusing on linking a CSS file for styling. The user has structured their HTML file, assign5A.html, located in the public_html directory, and is attempting to apply styles from mystyles.css located in a subdirectory. They aim to define a class called "body" to set the background color and text properties. Key points include the correct syntax for linking the CSS file, the necessity of using a period before the class name in the CSS, and the understanding of attributes like "type" and "rel" in the link tag. The user initially struggled with applying the class to the body tag but received clarification on the purpose of these attributes, leading to a resolution of their issues. The discussion highlights the importance of proper file structure and syntax in web development.
jeff1evesque
Messages
312
Reaction score
0
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**
-----------------------------------------------------

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:
Technology news on Phys.org
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.
 
I tried it, doesn't seem to work. But I think you are correct, I'll play around with it.Thanks a lot,JL
 
"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.
 
Thanks for the help guys. I found the solution to my problems.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Replies
9
Views
2K
Replies
2
Views
1K
Replies
3
Views
2K
Replies
3
Views
2K
Replies
3
Views
3K
Replies
3
Views
9K
Back
Top