473,231 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

HTML will not link to CSS file

I just started to learn. I can't get the code in my CSS file to link to my HTML file to produce the web page I want.

The code I've used is;

<link rel="stylesheet" type="txt/css" href="bkkcss.css /">


And in the CSS sheet is;

body
{margin:0;
padding:0;
background-color:##003300
}


And when I validate I get the following which I don't fully understand;

The validator has found the following problem(s) prior to validation, which should be addressed in priority:

Missing "charset" attribute for "text/xml" document.
The HTTP Content-Type header (text/xml) sent by your web browser (Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)) did not contain a "charset" parameter, but the Content-Type was one of the XML text/* sub-types.

The relevant specification (RFC 3023) specifies a strong default of "us-ascii" for such documents so we will use this value regardless of any encoding you may have indicated elsewhere.

If you would like to use a different encoding, you should arrange to have your browser send this new encoding information.

Conflict between Mime Type and Document Type
The document is being served with the text/xml Mime Type which is not a registered media type for the XHTML 1.1 Document Type. The recommended media type for this document is: application/xhtml+xml

Using a wrong media type for a certain document type may confuse the validator and other user agents with respect to the nature of the document, and you may get some erroneous validation errors. How to fix this problem? One of the following techniques should help:

If you are serving a static file on a Web server, changing its extension should help. Use e.g .xhtml for XHTML or .mathml for MathML.
You may need to reconfigure your Web server. This Setting up MIME Types tutorial has instructions for Apache, Tomcat and IIS.
If the document is generated dynamically, the scripting language should allow you to set up the mime type: this article on MIME Types and Content Negotiation has examples in PHP, Perl, and ASP.


I am in an internet place in Bangkok so maybe the browser isn't very good. I've tried Firefox and IE.

When I put the CSS code and HTML code in the same file I'm getting things to work ok.

Regards

Jim Walsh
Aug 14 '07 #1
5 2431
MrPutty
13
Hey Jim,

have you checked your paths? Throw both files in the same directory.

<link rel="stylesheet" type="txt/css" href="bkkcss.css /">
and try without "/"
<link rel="stylesheet" type="txt/css" href="bkkcss.css">

That should work for you.
Aug 14 '07 #2
drhowarddrfine
7,435 Expert 4TB
1) For the background-color, there should be only one '#' symbol.
2) There is no mime-type of text/xml and should be changed to 'application/xml' but are you truly using XML?
3) application/xhtml+xml is only recognized by modern browsers and not Internet Explorer.
Aug 14 '07 #3
Hey Jim,

have you checked your paths? Throw both files in the same directory.

<link rel="stylesheet" type="txt/css" href="bkkcss.css /">
and try without "/"
<link rel="stylesheet" type="txt/css" href="bkkcss.css">

That should work for you.
Thanks for your time Mr Putty. Truly appreciated.

I took the / off and it worked just fine.

Regards

Jim Walsh
Aug 15 '07 #4
1) For the background-color, there should be only one '#' symbol.
2) There is no mime-type of text/xml and should be changed to 'application/xml' but are you truly using XML?
3) application/xhtml+xml is only recognized by modern browsers and not Internet Explorer.
Hi drhowarddrfine

The extra # was careless. I actually sorted the problem by taking the final / from the link field.

So where do I change text/xml to application/xml? Maybe it's obvious to you but I've only been doing this for a week and not everything is easy yet. And as for really using xml, I've no idea. I got a book called HTML and CSS in 24 Hours by Dick Oliver and Mchael Morrison and took it from there.

It's real good fun though.

And sincere thanks for your time.

Regards

Jim Walsh
Aug 15 '07 #5
MrPutty
13
Hello Jim,

I'd like to recommend using a directory structure when coding. It'll make life a lot easier on you when projects start to grow. What you'll need for now is:

- a root directory (helps when you upload your project to a sever)
- a directory for: html docs, css docs and images.

possible structure:
- html
+ - doc
+ - css
+ - img

Just my two cents on this matter. The HTML code below uses the structure above to link to the stylesheet. href="../css/stylesheet.css"

you can try this: use the HTML below and fill in your <body> content. Adjust the path to the stylesheet, if needed. Your stylesheet looks fine to me (after drhowarddrfines correction). Try and valdiate your code.

Hope this works for you!

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <title></title>
  5. <link rel="stylesheet" type="text/css" href="../css/bkkcss.css">
  6. </head>
  7. <body>
  8. REMOVE THIS - YOUR CONTENT GOES HERE
  9. </body>
  10. </html>
Aug 15 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Akseli Mki | last post by:
Hi, Hopefully this is not too much offtopic. I'm working on a FAQ. I want to make two versions of it, plain text and HTML. I'm looking for a tool that will make a plain text doc out of the...
11
by: Brett | last post by:
In Yahoo mail, I click the Inbox link and see my messages. If I view source, I don't have HTML which contains the URL of each message. The source HTML contains javascripting and framesets. This...
8
by: mark126 | last post by:
If this is not the right group for this question, please advise me of a better one. I have a collection of simple HTML files, many of which just contain a paragraph or two of text. Some contain...
6
by: Paolo Pignatelli | last post by:
I have an aspx code behind page that goes something like this in the HTML view: <asp:HyperLink id=HyperLink1 runat="server" NavigateUrl='<%#"mailto:" &amp;...
9
by: anupamjain | last post by:
Hi, After 2 weeks of search/hit-and-trial I finally thought to revert to the group to find solution to my problem.(something I should have done much earlier) This is the deal : On a JSP...
78
by: Robert Baer | last post by:
The homepage i have had up and seemingly working is: http://oil4lessllc.com/ However, the validator has so many complaints, and being so incompetent, i have no clue as to how to fix it all. Would...
14
by: Rob Meade | last post by:
Hi all, I'm working on a project where there are just under 1300 course files, these are HTML files - my problem is that I need to do more with the content of these pages - and the thought of...
1
by: Nogusta123 | last post by:
Hi, I have had a lot of problems getting web pages, master pages and content pages to render in VS2005 design view the same as they would in Internet Explorer. I did a lot of looking on the...
7
by: Xah Lee | last post by:
Summary: when encountering ex as a unit in css, FireFox (and iCab) did not take into account the font-family. Detail: http://xahlee.org/js/ff_pre_ex.html Xah xah@xahlee.org ∑...
17
by: =?Utf-8?B?Y2F0aGFyaW51cyB2YW4gZGVyIHdlcmY=?= | last post by:
Hello, I have build a website with approximately 30 html-pages. When I search this website in Google, I see the index.html or home.html on this website, but also other html-pages on this...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.