Help - Search - Members - Calendar
Full Version: Css Confusion
BleepingComputer.com > Internet & Networking > Web Site Development
   
webrat
Hey folks,

This is my first post so I'll try and be clear. I'm basically a web junkie (not an IT pro) that started off tweaking SN profiles and has taken the plunge to build a site for stormchasing and related stuff. I thought I would go down the standards compliant route and use xhtml 1.0, build a wireframe frontpage and use stylesheets to see how it went. It didn't.

The xhtml rendered just fine, but the CSS is a no-go whether I use < link rel > or stick it direct in the head. The site is nothing special at this stage but I expected it to at least work based on using in-line CSS for profile tweaks. I'm using T.A Powell 'The Complete Reference: HTML & XHTML' as a source and it's worked ok so far but I'm pretty stumped right now.

Any thoughts would be appreciated.

Cheers

Jason
pislkie
Hell, I'm a newby too.

My advice would be to start by using a Document Type Declaration (DTD) that declares HTML 4.01
Much easier with less browser issues. A DTD is essential otherwise browsers adopt a non standards compliant mode refered to as "Quirks Mode".
My favourite DTD is:
QUOTE
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


Next, try making a blank page and include a single container (say a div) with text content. apply inline css to both.
When this displays as you intended and it should, transfer the css to an external style sheet referenced in the head of the document using:
QUOTE
<link rel=stylesheet href="stylesheet.css" type="text/css">

Take care to keep the main document and the CSS file on the same level eg both in root directory.

When you have donethis, you have learnt to ride a bike and away you go, next stop Tour de France.
webrat
QUOTE(pislkie @ Apr 8 2008, 06:20 PM) *
Hell, I'm a newby too.

My advice would be to start by using a Document Type Declaration (DTD) that declares HTML 4.01
Much easier with less browser issues. A DTD is essential otherwise browsers adopt a non standards compliant mode refered to as "Quirks Mode".
My favourite DTD is:
QUOTE
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


Next, try making a blank page and include a single container (say a div) with text content. apply inline css to both.
When this displays as you intended and it should, transfer the css to an external style sheet referenced in the head of the document using:
QUOTE
<link rel=stylesheet href="stylesheet.css" type="text/css">

Take care to keep the main document and the CSS file on the same level eg both in root directory.

When you have donethis, you have learnt to ride a bike and away you go, next stop Tour de France.


Hey Pislkie,

I was using a legit DTD for xtml 1.0 but the 4.01 spec does seem a little more flexible so thanks for that. I still can't get the < link rel > to function as the browser just seems to ignore it. I suspect it has something to do with the directory but I just can't figure it as the filepaths seem correct at a basic level.

However, I can now include the CSS in the head. It seems to be related to the closures used in the reference book I have which differ from the spec used on w3c for html 4.01 (I took a look based on your post). Using these it worked straight away. It may not be full-on but it's logical and tidy which is a great help.

Many thanks,

Jason


webrat
Hey folks,

Thought I would stick this in here to avoid starting a new thread as it's kinda related. Just wondered if position: absolute was the most effective/standards compliant method of placing images on-screen?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.