Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Old 05-14-2010, 03:05 PM Wow...
Extreme Talker

Posts: 201
Name: Brian
Trades: 0
So I am working on learning how to make sites in CSS, and not tables. I hear thats the new cool thing to do!

Anyway, this is my code I made,

Code:
<head>
<title></title>
<style type="text/css">
<!--
#centered {
  position: relative;
  top: 50%;
  left: 50%;
  margin-top: -25%;
  margin-left: -25%;
  background-color: red;
  color: white;
}
#header {
  background: green;
  position: absolute;
  top: 0px;
  left: 0px;
  width: 800px;
  height: 100px;
}
#leftcol {
  background: black;
  position: absolute;
  top: 100px;
  left: 0px;
  width: 150px;
  height: 500px;
  }
#rightcol {
	background: blue;
	position: absolute;
	top: 100px;
	right: 887px;
	width: 150px;
	height: 500 px;
	}
#content {
  background: red;
  position: absolute;
  top: 100px;
  left: 150px;
  width: 500px;
  height: 500px;
}
#footer {
  background: green;
  position: absolute;
  top: 500px;
  left: 0px;
  width: 800px;
  height: 100px;
}
-->
</style>
</head>
<body><div id="centered">
<div id="header">Header Section</div>
<div id="leftcol">Left Section</div>
<div id="rightcol">Right Section</div>
<div id="content">Content Section</div>
<div id="footer">Footer Section</div>
</div>
</body>
</html>
Very simple. But for some reason, when I get everything centered, my page just keeps on going. And I get this crazy amount of extra space to the right. Then when I take away the centered thing, my blue box on the right vanishes.

What am I doing wrong?

Thanks....

Last edited by bdg1115; 05-14-2010 at 03:16 PM..
bdg1115 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-14-2010, 03:09 PM Re: Wow...
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,376
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
http://www.webmaster-talk.com/css-fo...r-website.html
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-14-2010, 03:11 PM Re: Wow...
Extreme Talker

Posts: 201
Name: Brian
Trades: 0
Quote:
Originally Posted by chrishirst View Post
Yeah.. been there done that... Maybe should spend more time there.. haha.
bdg1115 is offline
Reply With Quote
View Public Profile
 
Old 05-14-2010, 03:12 PM Re: Wow...
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,376
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
AND


Do NOT use absolute positioning
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-14-2010, 03:13 PM Re: Wow...
Extreme Talker

Posts: 201
Name: Brian
Trades: 0
Quote:
Originally Posted by chrishirst View Post
AND


Do NOT use absolute positioning
But still have crazy space.

Code:
<html>
<head>
<title></title>
<style type="text/css">
<!--
#centered {
  position: relative;
  top: 50%;
  left: 50%;
  margin-top: -25%;
  margin-left: -25%;
  background-color: red;
  color: white;
}
#header {
  background: green;
  position: relative;
  top: 0px;
  left: 0px;
  width: 800px;
  height: 100px;
}
#leftcol {
  background: black;
  position: relative;
  top: 100px;
  left: 0px;
  width: 150px;
  height: 500px;
  }
#rightcol {
	background: blue;
	position: relative;
	top: 100px;
	right: 887px;
	width: 150px;
	height: 500 px;
	}
#content {
  background: red;
  position: relative;
  top: 100px;
  left: 150px;
  width: 500px;
  height: 500px;
}
#footer {
  background: green;
  position: relative;
  top: 500px;
  left: 0px;
  width: 800px;
  height: 100px;
}
-->
</style>
</head>
<body><div id="centered">
<div id="header">Header Section</div>
<div id="leftcol">Left Section</div>
<div id="rightcol">Right Section</div>
<div id="content">Content Section</div>
<div id="footer">Footer Section</div>
</div>
</body>
</html>

Last edited by bdg1115; 05-14-2010 at 03:18 PM..
bdg1115 is offline
Reply With Quote
View Public Profile
 
Old 05-14-2010, 03:24 PM Re: Wow...
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,376
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
All that positioning is NOT necessary, USE the document flow not fight against it AND you need a Doctype to ensure correct rendering.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-17-2010, 07:06 AM Re: Wow...
marry freelance's Avatar
Novice Talker

Posts: 7
Trades: 0
I think Also, Absolute positioning making problem.
__________________

Please login or register to view this content. Registration is FREE
marry freelance is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Wow...
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.74625 seconds with 12 queries