9 replies [Last post]
matthelm88
Offline
Regular
Last seen: 18 years 9 weeks ago
Joined: 2004-08-05
Posts: 37
Points: 0

what css do i need to add to center this site in the browser? Take a look at the css in the source code at:

http://www.ifyouwannabebadyougottabegood.com/cssTester.html

thanks

matthelm88

co2
co2's picture
Offline
Leader
UK
Last seen: 14 years 25 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

what css do i need to add to center this site?

Try:

#Table_01 {
margin-left: auto;
margin-right: auto;
width:789px;
height:762px;
}

Smile

Too much absolute positioning going on.

The next sentence is true. The previous sentence is false. Discuss...

matthelm88
Offline
Regular
Last seen: 18 years 9 weeks ago
Joined: 2004-08-05
Posts: 37
Points: 0

what css do i need to add to center this site?

i updated site...take a look...nothing happened...

do you know why?

matthelm88

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 39 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

what css do i need to add to center this site?

As Co2 says too much absolute positioning going on, it's just not the way to create a layout I'm afraid , sorry. For a start a DTD for the document would be a good idea as this will not be helping having the page display in quirks mode; for the moment you can try adding position:relative to the initial div that you have tried to center and pull out the body statements and put them in with the styles and define the body with a height 100% otherwise funny things seem to happen like double vertical scroll bars.

Hugo.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

co2
co2's picture
Offline
Leader
UK
Last seen: 14 years 25 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

what css do i need to add to center this site?

Yes, Hugo's right... I should've expanded on what I said. Simply doing what I said (auto margins) will only half-fix what you need. You really need to try a design without absolute positioning first.

And, yes, check up on using DOCTYPE's.

From your code, it looks like you are getting your HTML auto-generated from ImageReady? Personally, I wouldn't trust this at all (but I wouldn't even trust Dreamweaver either to tell the truth). If you really want to knock out solid CSS and XHTML, then ImageReady (or Photoshop etc.) HTML and CSS output probably won't help you.

The next sentence is true. The previous sentence is false. Discuss...

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 39 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

what css do i need to add to center this site?

I had a suspicion that this was generated code from some program .It seems to be an attempt to impose the old style image slice into a table structure -don't worry about the code the program will handle it all for you syndrome into a CSS structure, it doesn't work and does nothing for the CSS/Standards cause; I can only see this sort of thing as a crass attempt by these programs to pretend to be CSS/Standards compliant, this layout is overkill as well, you could produce the same design with far fewer images dropped into a proper CSS layout. Producing pages this way where it is all designed in an image program first and then code constructed as an afterthought to accomodate the visual design just kills me.
Apologies for having a rant ,its not aimed at yourself but rather these sorts of programs (if that is what it is ) they tend to make people believe they are designers/ coders when if you gave them 'notepad' and asked them to code a site they would pap themselves.
Again absolutly no offence intended but it would be better in the long run to rethink the layout and hand code it if possible, it is a fairly straightforward layout, shouldnt give you too many problems!

I'll shut up now that I've probably pi**ed you right off Smile

Hugo.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

co2
co2's picture
Offline
Leader
UK
Last seen: 14 years 25 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

what css do i need to add to center this site?

Just to add, you will find the overwhelming feeling of control over your code and design much more satisfying also... as opposed to wondering what the application is doing to your site.

Smile

The next sentence is true. The previous sentence is false. Discuss...

matthelm88
Offline
Regular
Last seen: 18 years 9 weeks ago
Joined: 2004-08-05
Posts: 37
Points: 0

what css do i need to add to center this site?

all comments are highly appreciated...its just that I have such limited time to learn css that I was hoping these programs would help me out. I actually am one of those guys that know s only a little code and does most work in photoshop and dreamweaver...
I want to learn css so bad but I must keep food on the table...i need to take a class or buy a dvd for learning from the web has made me only more confused....thanks for all your comments... I was just hoping that I found my quick solution for css sites...but as you've just proven too me this is not it.....

any recommendations for videos or dvds on css?

sincerely

matthelm88

Guy
Guy's picture
Offline
Enthusiast
Cambridge, UK
Last seen: 11 years 15 weeks ago
Cambridge, UK
Timezone: GMT+1
Joined: 2004-04-26
Posts: 54
Points: 0

what css do i need to add to center this site?

I found online tutorials the best way to go, books and such like tend to go out of date rather quickly (like most in the area of computing).
To start learning i found http://www.htmldog.com very useful indeed, and very short and quick. There are some technically incorrect statements in there, but very insignificant. For any extra resources you can look to http://www.w3schools.com/css which can come in handy! Not to forget that great online forum as well Wink !

Good luck

Who discovered we could get milk from cows, and what did he THINK he was doing at
the time? - Billy Connolly

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 39 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

what css do i need to add to center this site?

As for books I guess the best are probably anything by Eric Meyer and zeldmans latest tome, they are the only two authors I would recommend; as Guy says books tend to be out of date rather quickly I'm afraid that is the nature of CSS the best resources will always be on the net as things can be updated/ added to in a shot ,sadly there is no single great tutorial it comes down to having to piece together many bits of info.
As for DW if anything I think that it complicates coding rather than simplifies, it's that common misconception that as it can do all of this work for you it must be doing it correctly but it doesn't it just holds you back from learning and after all basic html/css isn't hard to hand code
at all. I know a fair few people/businesses that believe they understand web page coding because they have learnt a propriatory piece of software sadly that couldn't be further from the truth. At the end of the day use DW but understand how to do basic coding then you will be the master of the program rather than the other way around, I myself still use an old program called hotmetal pro because I like the source view it gives me with nice coloured text so I can pinpoint sections of code but I never go near any of it's other functions it just slows me down and produces bad code in fact I find that I become far more at ease with a plain text editor esp with mixed code like php/html.
Persevere, css is a slow learning curve overall (initialy fast) and full of mind numbing problems but is the way forward without doubt and I understand about keeping food on the table and of course you must do what is needed to that end.
Hugo.

p.s if you would like online links post back and I'll sort out some of the better required reading if its of help.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me