The online racing simulator
HTML/CSS question
1
(45 posts, started )
HTML/CSS question
A quick question for those more experienced with markup than myself.

How can I make a page layout like I've drawn, using CSS? I know how to cheat and do it with tables but I'm trying to do things the 'proper' way.

CSS for the two large divs is fine, it's the small two I can't get to work:

#CONTENT
{MARGIN: 0 auto;
WIDTH: 800px;
VERTICAL-ALIGN: top}

#LEFT
{your input here}

#RIGHT
{your input here}

Cheers
Attached images
layout.PNG
#2 - PaulH
#3 - SamH
CSS is pants. I tried using pure CSS with the CTRA site, but browsers don't support it. If I get it so it validates in code checkers, either IE7 or FF won't show it how it is. Usually FF is the worst, in fact.

Use tables, Bob. They want to deprecate them because Mozilla never ever managed to make them display properly, but it's no better at rendering CSS either. Use tables, and make a stand.
#4 - SamH
btw, if you want to have the two centred, then put them in a container DIV.

[edit] I mean, if you want the two COLUMNS* put them in a container DIV.
#5 - maczo
The two centered, fixed-width just need "margin-left" and "margin-right" set to "auto".
The other two could need wrapping elements around them. The outer elements would then have "float:right" and "float:left" and perhaps "width:50%". Then, inside them, the elements you want to be centred again should have margin-left/right: auto. I think this should work.
Quote from SamH :CSS is pants.

I highly disagree. You'd be surprised just how clean and universal proper CSS code is if you do it correctly. Hell, if I code my own sites I am nothing perfect, but there is A LOT one should know about CSS before saying it is crap. The only thing that really creates barriers with what you try and design, is the kind of site you are trying to make... and knowing what is or isn't possible. An example being when designers want to make a specific block area and use way too many float and block variables... it gets really messy. Just a new generation of old school html-style coding so to speak.
#7 - Ian.H
Quote from Tweaker :I highly disagree. You'd be surprised just how clean and universal proper CSS code is if you do it correctly. Hell, if I code my own sites I am nothing perfect, but there is A LOT one should know about CSS before saying it is crap. The only thing that really creates barriers with what you try and design, is the kind of site you are trying to make... and knowing what is or isn't possible. An example being when designers want to make a specific block area and use way too many float and block variables... it gets really messy. Just a new generation of old school html-style coding so to speak.

People only claim CSS is crap because they simply don't get it, and m$ runtpage doesn't handle it well, so they use tables embedded in tables embedded in tables embedded in tab............... and claim to be a web deezyner! :cool: Tables are for tabular data, no more, no less


In regards to Bob's question.. the following should work. Note I only added borders around the elements etc to make them stand out and easy to identify for this example.

<html>
<head>
<title>Test</title>
<style>
body {
width: 100%;
padding: 0;
margin: 0;
}

div#top-box,
div#bottom-box {
width: auto;
height: 100px;
border: 1px solid #B8D1F8;
clear: both;
}

div#middle-boxes {
width: auto;
}

div#middle-boxes div#right-box {
width: 300px;
height: 100px;
border: 1px solid #B8D1F8;
margin: 20px 30px 20px auto;
float: right;
}

div#middle-boxes div#left-box {
width: 300px;
height: 100px;
border: 1px solid #B8D1F8;
margin: 20px auto 20px 30px;
float: left;
}
</style>
</head>
<body>
<div id="top-box">
Top box
</div>
<div id="middle-boxes">
<div id="right-box">
Right box
</div>
<div id="left-box">
Left box
</div>
</div>
<div id="bottom-box">
Bottom box
</div>
</body>
</html>

HTH.



Regards,

Ian
Attached images
bs.png
You should see some of Sam's code, it makes young children cry, and kills kittens.
#9 - Ian.H
Quote from dawesdust_12 :You should see some of Sam's code, it makes young children cry, and kills kittens.

That's what you get when you use WYSINWYG editors and think you're a developer



Regards,

Ian
Each time a table is used, God kills a small kitten.

Hence Sam's sites killing kittens.

QED.

:P
Quote from SamH :CSS is pants. [...] Use tables, Bob.

Biggest load of tripe I've heard all week.

(Apologies for the short post, but Tweaker and Ian.H have all my points covered)
Quote from SamH :CSS is pants. I tried using pure CSS with the CTRA site, but browsers don't support it. If I get it so it validates in code checkers, either IE7 or FF won't show it how it is. Usually FF is the worst, in fact.

All of the above statements are either totally false or largely erroneous in one way or another.

http://www.csszengarden.com

EDIT: Oh look - by the time I finally posted this SamH got it... several times... ah well - still, the above stands.
Yes, real designers modify free templates...


:hide:


:hopes nobody goes to dustindawes.com and see's the awfulness:
Quote from pb32000 :Each time a table is used, God kills a small kitten.

Good to know. I'll (try to) add even more tables to my site then.
Ah thanks Ian, it need a tiny adaption to work in a fixed width website but otherwise was exactly what I was looking for.

Cheers
REAL web designers download and install joomla, and make it look different by editing 000000 colour codes and photoshopping template images.

#17 - SamH
Quote from Tweaker :I highly disagree. You'd be surprised just how clean and universal proper CSS code is if you do it correctly. Hell, if I code my own sites I am nothing perfect, but there is A LOT one should know about CSS before saying it is crap. The only thing that really creates barriers with what you try and design, is the kind of site you are trying to make... and knowing what is or isn't possible. An example being when designers want to make a specific block area and use way too many float and block variables... it gets really messy. Just a new generation of old school html-style coding so to speak.

You make a good point.. in order to code good CSS, you have to design within the constraints of CSS. Knowing, as you say, what is and isn't possible. And that's generally where I fall out with CSS. Not because it can't be achieved with CSS, but because it's so much goddamned time wasted to achieve in pure, cross-browser CSS, particularly when the same things can be done with traditional HTML.

I'm not averse to CSS and I do make more and more use of it. When I created the new CTRA site, I started out with strict CSS. It was only when I began to run out of time that I found myself forced to accelerate the development by adding very simple HTML containers. Mostly, though, the HTML I added was for data anyway, and since tables are W3C for delivering data, I don't think I stepped too far out.

Maybe I'll go back through and move more of the HTML over to CSS, but it'll have to be when I have a lot more time to waste than I do now. Until then, I'll make no apology for a site that displays perfectly fine in all modern browsers
#18 - SamH
Quote from tristancliffe :REAL web designers download and install joomla, and make it look different by editing 000000 colour codes and photoshopping template images.


hehe!!
Being a relative newcomer to web coding, and someone who is more into coding 3D game engines than low bandwidth word documents, I think CSS is fine for what it is. The only way I know how to make a web page is with CSS, I hate tables - but mostly because to make web pages I use notepad, and tables seem to me to be more the domain of WYSIWYG editors.

The problem with CSS is that it completely fails to perform it's stated purpose, to seperate design from content. A CSS based web site is, for the most part, still entirely dependent upon design elements embedded within the content, at least at a structural level. Put your web site into one of my CSS files [after fixing label names] and you will see what I mean...

I just cannot bring myself to see the 'golden grail' in CSS, I dont know whats so great about it. As a programming language it is still crude with sub-BASIC and non-consistent syntax, it doesnt achieve its designated aim, and overall serves to do little more than add a layer of complication to justify the huge salaries of web designers.

The internet appears to have not have realised it, but computers got very advanced a long time ago and now only support 2D under emulation...
#20 - wien
Quote from SamH :They want to deprecate them because Mozilla never ever managed to make them display properly, but it's no better at rendering CSS either

Oh puh-lease. That's the biggest load of crap I've ever heard. Like others have said, tables are for tabular data. Using them for layout isn't "deprecated", it's just wrong. If you had ever tried to read a page coded using tables for layout with a screen-reader/mobile phone/text-based browser you'd know how horrible it is. It doesn't exactly do wonders for page size either.

True, you didn't have much of a choice before CSS came along, but that's 10 years ago now! 10 years! And still Microsoft hasn't managed to fix their implementation. It's quite astonishing really. Mozilla, along with most other browser vendors have more or less perfect support up to CSS version 2. Microsoft is so far behind in their support it's seriously holding me back when I write HTML/CSS. You can even do table layouts, just like you're used to, using divs and CSS but IE doesn't support it so you can't.

To give you a feel for how bad it really is, I recently spent about a day making a slick layout for Joomla using HTML/CSS exclusively. This layout worked first time in ALL (every single one) of the browsers I tried (Firefox, Opera, Safari, Konqueror, even my Sony Ericsson), except IE versions 6 and 7. The problems with IE were in fact so extensive I spent the next day trying to fix all the rendering errors and downright stupidities by using all kinds of hacks to make IE behave. That's an entire day of just messing around with IE, and it still isn't right. In addition I had to make a lot of compromises on what users of other browsers see, so IE is in fact lessening the experience for everyone, even people who don't use it.

As you can probably tell by now this situation makes me so mad I could explode, and when I see people blame it all on Mozilla not rendering tables correctly (which they do), I'm about ready to give up on this industry.

Rant over... EDIT: Or not
Quote from Becky Rose :The problem with CSS is that it completely fails to perform it's stated purpose, to seperate design from content. A CSS based web site is, for the most part, still entirely dependent upon design elements embedded within the content, at least at a structural level. Put your web site into one of my CSS files [after fixing label names] and you will see what I mean....

Now that I can agree with. CSS is a far cry from what it should be, and as you say, the way you have to embed design elements in the HTML to do what you want is moronic at best.

But again I'd like to place the blame squarely at Microsoft's feet. There are a LOT of features in CSS2 and eventually 3 that could help alleviate a lot of these problems (Image based borders, display : table-cell etc.), but we just can't use them because IE doesn't support them. Even the W3C has said they don't want to do too much to CSS going forward because they don't want to get too far ahead of the implementations. They have stopped improving CSS because Microsoft (and thus the major browser on the web) doesn't implement the standard anyway.
-
(wien) DELETED by wien : Double post
#21 - SamH
Quote from wien :To give you a feel for how bad it really is, I recently spent about a day making a slick layout for Joomla using HTML/CSS exclusively. This layout worked first time in ALL (every single one) of the browsers I tried (Firefox, Opera, Safari, Konqueror, even my Sony Ericsson), except IE versions 6 and 7. The problems with IE were in fact so extensive I spent the next day trying to fix all the rendering errors and downright stupidities by using all kinds of hacks to make IE behave. That's an entire day of just messing around with IE, and it still isn't right. In addition I had to make a lot of compromises on what users of other browsers see, so IE is in fact lessening the experience for everyone, even people who don't use it.

Your experience isn't dissimilar from mine. The difference is that you threw another day at the problem, while I worked around it in an hour by going back to HTML in the short term. Your complaint is still the same as mine, however.. time and lack of cross-browser compatibility. It's our short-term solutions that differ.

CSS does fall short in many respects, even CSS2. It's a stop-gap, but I agree with Becky that it's a poor offering as yet.

[edit]
Quote from wien :But again I'd like to place the blame squarely at Microsoft's feet. There are a LOT of features in CSS2 and eventually 3 that could help alleviate a lot of these problems (Image based borders, display : table-cell etc.), but we just can't use them because IE doesn't support them. Even the W3C has said they don't want to do too much to CSS going forward because they don't want to get too far ahead of the implementations. They have stopped improving CSS because Microsoft (and thus the major browser on the web) doesn't implement the standard anyway.

Here, we disagree. I have been very irritated by the W3C's blatant anti-MS approach for 10 years, now. There's a lot of spin about how MS doesn't implement CSS2 standards, while there is a LOT more to the story than just that.
#22 - wien
Quote from SamH :The difference is that you threw another day at the problem, while I worked around it in an hour by going back to HTML in the short term.

I'd love to be able to do that, but since accessibility is part of the project requirements that's just not an option. I'm even required by law here in Norway to make my sites accessible. That means any extra time I spend is going out of my profit on the project. If you add up all the hours wasted by designers the world over because of IE I'm positive we could fund it's entire development ten times over.
Quote from SamH :There's a lot of spin about how MS doesn't implement CSS2 standards, while there is a LOT more to the story than just that.

Do tell. You are aware MS is a member of the W3C right? How can they be anti MS?
#23 - SamH
I know it looks like Microsoft is the big baddy, but they're actually very active in the accessibility department. In fact, they're one of this aspect's strongest proponents. There is a resistance to Microsoft within the W3C which is actually the core hindrance in this.
#24 - wien
Quote from SamH :There is a resistance to Microsoft within the W3C which is actually the core hindrance in this.

What exactly is preventing MS from implementing the standards they have all agreed upon? Everyone else seems to do it just fine?
Quote from Becky Rose :The problem with CSS is that it completely fails to perform it's stated purpose, to seperate design from content. A CSS based web site is, for the most part, still entirely dependent upon design elements embedded within the content, at least at a structural level.

Are you arguing here that the structure of the document is in itself an element of the design and therefore the design cannot ever be separated from the document, or making a different point that I haven't understood?

Quote from SamH :There is a resistance to Microsoft within the W3C which is actually the core hindrance in this.

Probably because Microsoft frequently does silly things like adding its own proprietary extensions to HTML and CSS to do frivolous things like moving text or colouring in the browser scrollbars. :rolleyes:
1

HTML/CSS question
(45 posts, started )
FGED GREDG RDFGDR GSFDG