PDA

View Full Version : DIVS



Rockstar
07-10-2007, 11:05 AM
Ok i can code in iFrames and expandbles but people now seem to use DIVS what is it and is their and tuts for it.

Chippiewill
07-10-2007, 01:03 PM
Divs are really easy tbh and far better than tables

Example one:



<div id="text" style="position:absolute;left:48px;top:328px;width:150px; height:50px;z-index:2" align="left">
You can position text anywhere on the page!
</div>


Example 2:



<style type="text/css">
#text {
position:absolute;
left:48px;
top:328px;
width:150px;
height:50px;
z-index:2;
}
</style>
<body>
<div id="text" align="left">You can position text anywhere on the page! </div>


Both would produce the same (I think) but one the location is stored in CSS and the other (actually i think its still css) in the actual div. Alignment (I think) must be in the div (not confirmed)

ps there are proably coding errors (aswell as spelling)

--ss--
07-10-2007, 01:20 PM
If your coding with divs then you'll need CSS knowledge , you set everythign up with css like the size and positioning then you do your div tag and write the html init , This is a basic code for a simple layout with just a banner and main content area.


<html>
<head>
<title>Sitename</title>
<style type="text/css">
<!--
body {
margin: 0px;
padding: 0px;
}
#header {
background-image: url(http://) ;
width: 100%;
height: 50px;
}
#content {
background: #6495ED;
width: 100%;
height: 500px;
text-align:center;
}
-->
</style>
</head>
<body>
<div id="header"><img src="http://bannerimage"></div>
<div id="content">Content</div>
</body>
</html>
Just study the codes of sites with divs on and you'll get the drift.

RichardKnox
07-10-2007, 01:49 PM
Divs are really easy tbh and far better than tables

Example one:



<div id="text" style="position:absolute;left:48px;top:328px;width:150px; height:50px;z-index:2" align="left">
You can position text anywhere on the page!
</div>
Example 2:



<style type="text/css">
#text {
position:absolute;
left:48px;
top:328px;
width:150px;
height:50px;
z-index:2;
}
</style>
<body>
<div id="text" align="left">You can position text anywhere on the page! </div>
Both would produce the same (I think) but one the location is stored in CSS and the other (actually i think its still css) in the actual div. Alignment (I think) must be in the div (not confirmed)

ps there are proably coding errors (aswell as spelling)

Loads of coding errors. For a start with DIV's why the hell use align="" in it? Thats what the float element is for.

Rockstar
08-10-2007, 02:06 PM
so what tut shall I use and how is thise coduing the layout :S
Sos am a newb at coding

ScottDiamond.
08-10-2007, 03:51 PM
Divs are really easy tbh and far better than tables

Example one:



<div id="text" style="position:absolute;left:48px;top:328px;width:150px; height:50px;z-index:2" align="left">
You can position text anywhere on the page!
</div>
Example 2:



<style type="text/css">
#text {
position:absolute;
left:48px;
top:328px;
width:150px;
height:50px;
z-index:2;
}
</style>
<body>
<div id="text" align="left">You can position text anywhere on the page! </div>
Both would produce the same (I think) but one the location is stored in CSS and the other (actually i think its still css) in the actual div. Alignment (I think) must be in the div (not confirmed)

ps there are proably coding errors (aswell as spelling)

What a load of crap! Why the hell would you use align="" and why the hell have you got all that junk that isn't needed?

Invent
08-10-2007, 03:53 PM
And, why are you using position absolute. It's the worst thing to code a WHOLE layout in.

Chippiewill
08-10-2007, 04:00 PM
ps there are proably coding errors (aswell as spelling)


Hello i didnt say it was perfect :rolleyes:

Nli.
08-10-2007, 04:10 PM
And, why are you using position absolute. It's the worst thing to code a WHOLE layout in.
Isnt that when you open it up in a webeditor and you can move it any where on the page? or am i mixed up with something else..

Moh
08-10-2007, 04:21 PM
hehe were learning how to do this at college, im the only who who knows about css apart from the tutor and for once I feel advanced xD But on this forum, I feel a noob :p

ScottDiamond.
08-10-2007, 04:38 PM
Isnt that when you open it up in a webeditor and you can move it any where on the page? or am i mixed up with something else..

Yes it is... and it sucks.


And, why are you using position absolute. It's the worst thing to code a WHOLE layout in.

Yes.

RedCrisps
08-10-2007, 04:42 PM
i would use divs buh the thing i dont get is how do you make like the background thingy, like on tables its <td background="url.gif" and i have no idea how it works on divs :D

ScottDiamond.
08-10-2007, 04:57 PM
i would use divs buh the thing i dont get is how do you make like the background thingy, like on tables its <td background="url.gif" and i have no idea how it works on divs :D

You would do it in CSS.

background-image: url('urltoimage.gif');

Colin-Roberts
08-10-2007, 05:46 PM
or if you want the image to repeat:
background-image: url('urltoimage.gif') repeat; (both ways)

background-image: url('urltoimage.gif') repeat-x; (horizontal)
background-image: url('urltoimage.gif') repeat-y; (vertical)

Sygon..
12-10-2007, 07:44 PM
Whats with the wasting of code "background-image" how cheap can this get:




background: url(path) repeat-x;




Or you dont even need to put a repeat for it to repeat both ways.

Want to hide these adverts? Register an account for free!