PDA

View Full Version : [TUT] How to code in Divs [Gangster]



Gangster
20-03-2008, 06:15 PM
In this tutorial i will explain to you how to code in Divs with dreamweaver. I will try my best to show you how it should like like every few steps. Coding in Divs with Dreamweaver actually isn't hard.

1. First, you will have to slice up your layout. Make sure that you slice your boxes into 3 different parts. Top, Middle and Bottom. This is because you want the middle part to expand. I'm using this box for this tutorial. http://www.iaza.com/work/080321C/box_1_example63757.PNG

2. Once you've sliced up your layout, make a new HTML Document. Then, on the dropdown menu next to Standard, select Layout, the items on the left should then change. Select Draw AP Div.

3. Once you've drawn a div, make the attributes to the size of the image you sliced. I;m going to make it W; 193px and H; 34px. Because that is the attribute for the top of my box.
http://www.iaza.com/work/080321C/box_1_example_top83773.PNG.

4. Go to Windows > Insert > Image. Then insert the top of your box. Once you've done that, your code should look like this.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
#apDiv1 {
position:absolute;
left:56px;
top:14px;
width:193px;
height:34px;
z-index:1;
}
-->
</style>
</head>

<body>
<div id="apDiv1"><img src="file:///C|/Documents and Settings/Jordan/My Documents/tut/box 1 example top.PNG" width="193" height="34" /></div>
</body>
</html>
5. Make the background image the top of your box. This is done by clicking the AP DIV the image is in, you don't click the Image itself, you click the AP Div. Then at the right of your screen it should say CSS styles, Under summary for section double click one of the options. Then once it's opened a new window, go to background and make the background image the top of your box.

6. Come out of the window, and delete the image, The same image should appear, that is your background image. You should now be able to type on that. Your code should now look like this.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
#apDiv1 {
position:absolute;
left:56px;
top:14px;
width:173px;
height:14px;
z-index:1;
background-image: url(file:///C|/Documents%20and%20Settings/Jordan/My%20Documents/tut/box%201%20example%20top.PNG);
padding: 10px;
}
.style1 {
color: #FFFFFF;
font-family: Verdana;
font-weight: bold;
font-size: 11px;
}
-->
</style>
</head>

<body>
<div id="apDiv1">
<div align="center" class="style1">This is a box</div>
</div>
</body>
</html>
and design should look like http://www.freewebs.com/divstut/

7. So now you can position it. By brining up that same window as before.

8. So, now you've just coded in a div. You will need to do this for the middle of the box and the bottom. To make the middle expandable is really easy, all you have to do is apply no height then you can make it any height you want.

9. The end result of this should be like this. http://www.freewebs.com/divstut/index1.html

Thank you for reading this tutorial, hope it helped!

rawritsluke
20-03-2008, 06:23 PM
It would be just as easy to do this:

<style>
<!--
#navbox {
width: width of the nav here!
}
#navtop {
background-image: url(urlhere);
width: width of the nav top;
height: height of the nav top;
}
#navmiddle {
background-image: url(urlhere);
width: width of the nav middle;
background-repeat: repeat-y;
}
#navbottom {
background-image: url(urlhere);
width: width of nav bottom;
height: height of nav bottom;
}
-->
</style>
<body>
<div id="navbox">
<div id="navtop"></div>
<div id="navmiddle">whatever you want in box here</div>
<div id="navmiddle"></div>
</div>
</body>


Thats how easy it could have been done in notepad :)
Good tut but --SS-- did the same one..

Gangster
20-03-2008, 06:24 PM
It would be just as easy to do this:

<style>
<!--
#navbox {
width: width of the nav here!
}
#navtop {
background-image: url(urlhere);
width: width of the nav top;
height: height of the nav top;
}
#navmiddle {
background-image: url(urlhere);
width: width of the nav middle;
background-repeat: repeat-y;
}
#navbottom {
background-image: url(urlhere);
width: width of nav bottom;
height: height of nav bottom;
}
-->
</style>
<body>
<div id="navbox">
<div id="navtop"></div>
<div id="navmiddle">whatever you want in box here</div>
<div id="navmiddle"></div>
</div>
</body>


Thats how easy it could have been done in notepad :)
Good tut but --SS-- did the same one..

Yeah i know, but i find this easier, so i thought others would aswell.

rawritsluke
20-03-2008, 06:25 PM
+REP to you for doing the tut. I wasn't flaming you for doing it, it's a nice idea and easy for new coders :) Just giving as an example for someone who wants to code without programs, just using a simple text editor like Notepad :)

Unpredictible.1
20-03-2008, 06:27 PM
*Removed*

Edited by Kaotix12 (Forum Moderator): Please do not accuse others of ripping.

Gangster
20-03-2008, 06:28 PM
+REP to you for doing the tut. I wasn't flaming you for doing it, it's a nice idea and easy for new coders :) Just giving as an example for someone who wants to code without programs, just using a simple text editor like Notepad :)
KK, ty.


Hold on.

Since when can you start coding :S
Since i decided to learn...

rawritsluke
20-03-2008, 06:29 PM
Hold on.

Since when can you start coding :S
Lmao CSS is so easy to learn so anyone can code css in a matter of hours or if they're slow learner days. Personally I learnt in hours :)

Unpredictible.1
20-03-2008, 06:31 PM
No I just don't believe he made the tutorial but 'good tutorial'

Gangster
20-03-2008, 06:31 PM
No I just don't believe he made the tutorial but 'good tutorial'
Lol, if you've learnt and you know how to do it, then you can make a tut...

rawritsluke
20-03-2008, 06:31 PM
No I just don't believe he made the tutorial but 'good tutorial'
I did suspect with the "apDiv" as I've seen that elsewhere on a tutorial but who knows. I'm not going to say he's ripped with no proof :)

Gangster
20-03-2008, 06:32 PM
No I just don't believe he made the tutorial but 'good tutorial'
Lol, if you've learnt properly how to do it, then you can make a tut... It's like, once you've properly learnt a football skill, you can teach it to other people.

Gangster
20-03-2008, 06:33 PM
I did suspect with the "apDiv" as I've seen that elsewhere on a tutorial but who knows. I'm not going to say he's ripped with no proof :)
when you draw a div with Dreamweaver it automatically names it #apDiv, try it if you don't beleive me

Soz for double post.

rawritsluke
20-03-2008, 06:50 PM
My bad :P Don't always use dreamweaver, notepad <3

SATIRE
20-03-2008, 07:22 PM
Wrong wrong wrong wrong wrong!!!

You're better making your own Divs instead of drawing them, that way you have better control and it isn't as messy.

Nice tutorial otherwise.

Moh
20-03-2008, 10:12 PM
The title div needs padding :p

Klydo
21-03-2008, 05:32 AM
Why are you using position to place your div, I don't understand :S

I would always start out with a wrapper then simply put divs inside it. You've over complicated the use of DIVs.

Romanity
21-03-2008, 03:14 PM
How would you make it expand width ways aswell ... ?

Gangster
21-03-2008, 03:25 PM
How would you make it expand width ways aswell ... ?
just apply no width

rawritsluke
21-03-2008, 05:43 PM
How would you make it expand width ways aswell ... ?
Don't listen to what gangster said.
Apply no width AND.
background-repeat: repeat-y;

If you looked at my example you would see better :P

Romanity
24-03-2008, 05:41 PM
Yeh i was thinking it wouldnt work... lol
Got it now :)
x

Pazza
24-03-2008, 07:39 PM
easier to understans than --ss-- , but could you make on on how to do it for a full site.

Like a site isn't just 1 boc, there is content, radio etc.

Meti
23-04-2008, 02:05 PM
People, note, dont say im bumping the thread, i just watched this tutorial, and i cant understand it.

---------------------------
I like this, but it would be better if you added more images?

You just added like 2 of them

Excellent
23-04-2008, 02:10 PM
People, note, dont say im bumping the thread, i just watched this tutorial, and i cant understand it.

---------------------------
I like this, but it would be better if you added more images?

You just added like 2 of themWhat is the need for more images? You can just do the same way he did it..

Protege
23-04-2008, 03:26 PM
What is the objective in copying though and if he did hes informing others of CSS and some people should take the curtsy and respect of what hes done - in retrospect, your a complete failure. "Unpredictible.1" its good that your banned, this forum doesn't need people like you.

Meti
24-04-2008, 06:16 AM
anyways, i found the problems i couldn't find :)

Instrumentals.
24-04-2008, 08:00 AM
What is the objective in copying though and if he did hes informing others of CSS and some people should take the curtsy and respect of what hes done - in retrospect, your a complete failure. &quot;Unpredictible.1&quot; its good that your banned, this forum doesn't need people like you.

Tuff, I'm always here, never getting away. I may get banned but Ill come again ;)

Independent
24-04-2008, 10:59 PM
Useless, there's already a sticked tutorial on this.

Protege
25-04-2008, 12:54 AM
[/B]
Tuff, I'm always here, never getting away. I may get banned but Ill come again ;)
Then you must be seriously sad giving into Habbox like that. Thats what they want you to do. Get real bra.

dobbin
25-04-2008, 11:23 AM
It would be better if you added images of you in dreamweaver would help me.

Instrumentals.
25-04-2008, 06:15 PM
Then you must be seriously sad giving into Habbox like that. Thats what they want you to do. Get real bra.

Not sad, I only post in certain topics, that's why i only have around 30 posts. I would of had 200 by now.

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