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.
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

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