Help - Search - Members - Calendar
Full Version: Fluid Css
Zymic Webmaster Forums > Web Design & Development > Client Side Scripting > HTML and CSS
Drake14
I can't get this fluid thing with CSS to work. I've tried looking at tutorials and don't understand why it's not working with my site. I think i may have to re-code my CSS.

does anyone know how fluid CSS works?
XyberForce
Perhaps delete the wrapper div?
Magnus
width:100%;
Drake14
QUOTE(Magnus @ Jan 10 2008, 02:11 AM) *
width:100%;


I tried that, and all it does is just make the width even wider. I tried doing something like

float: left;

and it seemed to kind of work.

I'll play around with it some more.
Alex
You just need to use relative measurements (% usually) rather than fixed measurements (px, etc). A very simple example of a fluid site could be something like this (apply the CSS to a basic well formed HTML page):

CODE
* { margin: 0; padding: 0; }
html, body
{
   margin: 0 auto;
   font: 12px arial,sans-serif;
}
html
{
   background: #e7e7e7;
   color: #000;
}
body
{
   width: 80%;
   background: #fff;
   color: #000;
}


That gives you a relative width one-column layout. If you understand CSS-based websites it's not hard to see how that can be extended to multiple columns and more complex structures.
Drake14
thanks!

that worked great! but now the text won't wrap even though i have the overflow: scroll; tag.

any ideas?

Popcorn
Can you give me a link or show the source here? I might be able to help.
Drake14
i've started something else that i think might work...but something is wrong. i can't see my "nav" div.

CSS:

CODE
* { margin: 0; padding: 0; }
html, body
{
   margin: 0 auto;
   font: 12px arial,sans-serif;
}
html
{
   background: #;
   color: #;
}



body
{
   width: 80%;
   background: #;
   color: #;
}

a:link     {color:gold}
a:visited  {color:gold}
a:hover    {color:white}
a:active   {color:gold}

#header
{
background-image: url('images/header.jpg');
top: 0%;
background-position:
width: 100%;
height: 100%;
background-repeat: no-repeat;
}

#nav
{
background-image: url('images/nav.jpg');
top: 10%;
background-position:
width: 100%;
height: 0%;
background-repeat: no-repeat;
}












HTML:

CODE
<html>
<head>
<link rel="stylesheet" type="text/css" href="css.css" />
</head>
<body>


<tr>
<td>
<div id="header">
text
</div>


<div id="nav">
text

</div>





Andrew
You need to make the height something other than 0%...

0% makes it 0px, 0 is always 0, so make it something larger than 0
Drake14
i did that, and there was still nothing, it just made the page longer.
Drake14
now i can't move my divs......i can change the width and height of them....but THEY WON'T MOVE!!!!


>.< >.< >.< this is unbeleivably frustrating >.<
Andrew
Okay I don't know how your writing this (in a program, or by hand) but make sure that if this is supposed to be the width and height of the "background position"
CODE
background-position:
width: 100%;
height: 0%;

I would put it all on the same line, it makes for easier reading in the future, I thought that the width and height were just standard tags,
Now if those are supposed to be SEPERATE from background position, make SURE you have the semi-color ; after EVERY element, otherwise things start not working.
Jetteh22
no, trippin, you are right.

Drake, you never put anything for background position...

If you put something like

background-position: top left;
width: 100%;
height: 0%;

or whatever it will probably work.
otherwise it is reading it wrong and it probably just isn't showing it because of that.
Drake14
ok....this is really upsetting....everything i try isn't working.

i'm not sure if anyone knows what i REALLY want. so i'll try and explain it the best i can.

when i place my divs, i use an image for the background, a layout that i've sliced. but say if i minimize my browser window, each div gets messed up and everything is moved out of place, the same thing if i view it in a different resolution....

and if i put text divs over my background image divs, then those divs move around too. it doesnt make any sense. i'm pretty sure that i'm looking for a fluid layout...but it's not working at all...

is there another way to make everything line up? i've tried using tables but i'm not sure if i'm doing it right.
Drake14
i figured it out. asked for some help on another forum. all i had to do was use a wrapper div and margin tags.

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.