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
Help! Percentages NOT working!
Old 08-03-2009, 06:47 AM Help! Percentages NOT working!
Novice Talker

Posts: 9
Trades: 0
I'm trying to design a layout in which I'll have a container on either side of the screen which will just be sort of bold and gray. In any case, my percentages will NOT show up. Is there some problem with my CSS? I'm growing quite frustrated and don't know what to do. Here is the CSS I'm using to create a 50% all-black sidebar. I figure if I can make these percentages work then I can figure out everything else.

CSS:

{
margin: 0;
padding: 0;
}

body {
background: #FFFFFF;
text-align: justify;
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 12px;
color: #666666;
margin: 0px;
z-index: 0;
width: 100%;
height: 100%;
}

#left {
width: 50%;
height: 50%;
margin: 0 auto;
background: #000000;
z-index: 1;
}


HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>TEST</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="test.css" rel="stylesheet" type="text/css" />
</head>
<body>

<div id="left">
</div>

</body>
</html>

All I get is a blank white screen. I'm using Safari as a browser. What am I doing wrong!?
march11 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-03-2009, 07:55 AM Re: Help! Percentages NOT working!
Skilled Talker

Posts: 54
Trades: 0
Works for me, firefox. Maybe you did something wrong, like placed your stylesheet in another folder, idk.
KellyAX is offline
Reply With Quote
View Public Profile
 
Old 08-03-2009, 09:41 AM Re: Help! Percentages NOT working!
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Ok, z-index is useless on non-positioned elements, it ONLY works when something is set to position:absolute or relative.

The 100% height won't work properly unless you do it this way:
html, body{height:100%}

The width:100% on the body is pointless as that is the default.

Using margin: 0 auto; on #left won't put it to the left side, it will CENTER it on the screen.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 08-05-2009, 11:27 PM Re: Help! Percentages NOT working!
pdjprateek's Avatar
Experienced Talker

Posts: 38
Name: Prateek Jain
Location: India
Trades: 0
As LadynRed says margin: 0 auto; is useless, she is absolutely right there.

Try this inside your #left div.

left: 0;
margin-left: 0;

I really dont know if this will word out, but i think it should.

Prateek,
PDJSolutions
pdjprateek is offline
Reply With Quote
View Public Profile Visit pdjprateek's homepage!
 
Old 08-06-2009, 09:46 AM Re: Help! Percentages NOT working!
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Quote:
As LadynRed says margin: 0 auto; is useless
That is NOT what I said! Read my reply again.

Quote:
left: 0;
margin-left: 0;
If he want's it on the LEFT then margin-left: 0, would be sufficient, the left property is overkill.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 08-06-2009, 01:29 PM Re: Help! Percentages NOT working!
pdjprateek's Avatar
Experienced Talker

Posts: 38
Name: Prateek Jain
Location: India
Trades: 0
Hehe, chill you know, i just meant that in this case its useless . Because margin: 0 auto; would center the div as we are setting the left and right margin to auto there.

Anyways thanks for the info "left property is overkill" - i get confused b/w both sometimes.
__________________
I am a logo designer, doing logos at $20 . Mail me:
Please login or register to view this content. Registration is FREE
. for more details or if you want something to be done.
pdjprateek is offline
Reply With Quote
View Public Profile Visit pdjprateek's homepage!
 
Reply     « Reply to Help! Percentages NOT working!
 

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.26864 seconds with 12 queries