Jump to content

[SOLVED] Defining your box


DEVILofDARKNESS

Recommended Posts

I'm trying to do the same the same in css as the folowing:

<table border='100%' width='100%'>
<tr><td width='15%'>...</td><td width="85%">...</td>
</table>

 

is it something like?:

(I don't use margin, padding, border yet)

 

#navigation {

position: absolute;

width: 15%;

height: 100%;

font-weight: normal;

}

#Main {

position: absolute;

height: 100%;

width: 85%;

}

 

btw: I don't use pixels because I want to have the page displayed in every screen resolution the same.

Or is this also with pixels?

Link to comment
Share on other sites

Okay don't think about the text above,

 

I've this php script:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>Intro - CSS</title>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<link href="./css/index.css" rel="stylesheet" type="text/css">
</head>
<body>
	<div id="navigation">
	<i>Navigation</i>
	</div>
	<div id="main">
	Coming out Soon
	</div>
	<div id="footer">
	<i>Footer</i>
	</div>
</body>
</html>

 

and this css script:

 

body {

color: #FFFFFF;

background-color: #000000;

}

/************************* ID's *************************/

#navigation {

/*position: absolute;*/

float: left;

width: 15%;

height: 90%;

border: 1px solid #FFFFFF;

font-weight: normal;

}

#main {

/*position: relative;*/

float: left;

width: 75%;

height: 90%;

border: 1px dashed #FFFFFF;

}

#footer {

clear: both;

width: 100%;

height: 10%;

border: 1px dotted #FFFFFF;

}

 

But The Div's don't fill whole the page, what have I done wrong?

Link to comment
Share on other sites

Ok, now I see what you were trying to do. Try this:

 

CSS

	
*{margin:0;padding:0} 

body {
width:100%;
height:100%;
color: #FFFFFF;
background-color: #000000;
}


#box{width:100%; height:100%}
/************************* ID's *************************/

#navigation {
float: left;
width: 15%;
height: 90%;
border: 1px solid #FFFFFF;
font-weight: normal;
}

#main {
/*position: relative;*/
float: left;
width: 75%;
height: 90%;
border: 1px dashed #FFFFFF;
}

#footer {
clear: both;
width: 100%;
height: 10%;
border: 1px dotted #FFFFFF;
}

 

And the HTML:

   <body>
<div id="box">
      <div id="navigation">
      <i>Navigation</i>
      </div>
      <div id="main">
      Coming out Soon
      </div>
      <div id="footer">
      <i>Footer</i>
      </div>
</div>
   </body>
</html>

 

Here's a link to how it looks: test page.

Link to comment
Share on other sites

This is the page exactly as I have it on my site:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
   <head>
      <title>Intro - CSS</title>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
      <style rel="stylesheet" type="text/css">
*{margin:0;padding:0}
body {
width:100%;
height:100%;
color: #FFFFFF;

background-color: #000000;

}
html{height:100%}

#box{width:100%; height:100%}
/************************* ID's *************************/

#navigation {

float: left;

width: 15%;

height: 90%;

border: 1px solid #FFFFFF;

font-weight: normal;

}

#main {

/*position: relative;*/

float: left;

width: 75%;

height: 90%;

border: 1px dashed #FFFFFF;

}

#footer {

clear: both;

width: 100%;

height: 10%;

border: 1px dotted #FFFFFF;

}</style>
   </head>
   <body>
<div id="box">
      <div id="navigation">
      <i>Navigation</i>
      </div>
      <div id="main">
      Coming out Soon
      </div>
      <div id="footer">
      <i>Footer</i>
      </div>
</div>
   </body>
</html>

There's nothing wrong with your Doctype, am not understanding your question.

 

Maybe you linked to the external stylesheet wrong (as in, it's in the wrong folder/address)?

Link to comment
Share on other sites

Can you post a link to your site so we can see what's going on directly?

 

Your link may not be resolving to the right folder: add an extra . to make it ../css/index.css

 

One period (./) is going to the folder above (so your ./css is going to site.com/whatever/css/); but two (../) resolves to a relative url (so site.com/css/).

Link to comment
Share on other sites

Localhost doesn't help - that means it's running on your computer and not live (C:\inetpub\wwwroot\europia\css\index.css as it says on the error page).  :D

 

Anyway, you might have a renegade "background" or "background-color" somewhere, or even the way you set your browser to display. I know you can change browser background colors to whatever you want, you might have to check that.

Link to comment
Share on other sites

Nop, it has to work with localhost too becuase I specified a Non existing windows path, and the page was with and all the floats were away.

and the background was white!

 

I will just include whole the css in the file itself.

 

It has something to do with that doctype because if I let it away and I keep my external stylesheet, then it works like it should work.

 

I also used the W3C CSS validator and Html validator and they are both validated as valid.

Link to comment
Share on other sites

Even if I include the stylesheet in the page it won't work untill I remove the doctype! :o

Because it works with your example, I tried to do the same except I removed your css and added my css, but here something goes wrong?

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
   <head>
      <title>Intro - CSS</title>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
      <style rel="stylesheet" type="text/css">
* {
margin: 0;
padding: 0;
}
body {
color: #FFFFFF;
width: 100%;
height: 100%;
background-color: #000000;
}
/************************* ID's *************************/
#box {
width:100%;
height:100%;
}
#navigation {
/*position: absolute;*/
float: left;
width: 10%;
height: 90%;
font-weight: normal;
}
#main {
/*position: relative;*/
float: left;
width: 90%;
height: 90%;
}
#footer {
clear: both;
width: 100%;
height: 10%;
}
</style>
   </head>
   <body>
<div id="box">
      <div id="navigation">
      <i>Navigation</i>
      </div>
      <div id="main">
      Coming out Soon
      </div>
      <div id="footer">
      <i>Footer</i>
      </div>
</div>
   </body>
</html>

 

 

 

But I tried some different doctypes and only the following worked:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

 

I also tried some with URI's but those ignored my css percentages

 

(I read that that type of doctype still worked with older browsers, but I've downloaded Opera 7 yesterday, so I don't think that's the problem)

Link to comment
Share on other sites

If the background-color is a problem, you do have it set to black (#000) in your CSS style (white is #fff). Other than that, the CSS looks fine to me.

 

As far as doctype goes, I have no idea why your strict is not working, because it is on my layout. But if transitional works, then stick with that. Maybe strict is messing with previous settings, but I don't know.

 

Sorry I couldn't be of more help. :/

 

Link to comment
Share on other sites

Using a doctype is the right way to go. If your code was working without a doctype, it was probably only working in one browser. The doctype tells the browser what rules to evaluate the code by. If you don't include it, the browser has to guess, and different browsers make different guesses, meaning that your code isn't cross-browser compatible. So after adding a doctype, you may need to change your code, but that's a good thing.

 

In the future, it's best to start your code with the doctype already there, so you don't have to try and fix things later after adding it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.