Click to See Complete Forum and Search --> : can you align a div to the right of the page?


georgeafi
03-21-2003, 03:00 PM
I keep trying this and all it does is align the text. But i want to align the entire div to the right so i can have text outside and left of the div. When i try to put text on the outside the div just moves to the bottom of the page. I am wanting to have my links in the sme page instead of frames. I would do without the div but i can't get my text to align right and it driving me crazy. Thanks

Jona
03-21-2003, 03:11 PM
<DIV align="right"> isn't working for you? Did you try using tables instead? Can you show us your code?

DaveSW
03-21-2003, 03:14 PM
Try this in the head tag (it also sets the background color)
<STYLE TYPE="text/css">
.menu { float : right }
.menu { background-color: #FFC }
</STYLE>

And this in your div
<DIV CLASS="menu">
</Div>

Dave

georgeafi
03-21-2003, 03:34 PM
Niether one is working for me. All it does is make the div bigger so all the text fills the page instead of being within the div limits.

DaveSW
03-21-2003, 03:36 PM
Can you either post your code for us to check, or insert a link to it?

thanks
dave

georgeafi
03-21-2003, 03:38 PM
Here's the code



<style
type="text/css">
<!--
.menu { float : right }
.auto {
border: 0px solid #ccc;
background: #000000;
height: 160px;
margin: 20px;
width: 500px;
overflow: ;
color: 800000;}

-->
</style>
</head>

<body>
<div class="menu">

Jona
03-21-2003, 03:41 PM
This works for me:

<html><head>
<style
type="text/css">
<!--
.auto {
border: 0px solid #ccc;
background: #000000;
height: 160px;
margin: 20px;
width: 500px;
overflow: ;
color: 800000;}
-->
</style>
</head>

<body>
<div class="auto" align="right">
blahblahbalhalbhab
</div>
</body></html>

DaveSW
03-21-2003, 03:43 PM
you've got the width set to 500px, which is another contributing factor. Try reducing it to 150px or using 50%. 500px is big man!!!

Dave

DaveSW
03-21-2003, 03:49 PM
If I remember your site correctly, are you trying to float the menu left and the page content right? like this site? http://www.emdevelopments.co.uk/PPC2/Main_Menu.htm I read the flak you got for frames and have been attempting the same move lol.

dave

georgeafi
03-21-2003, 03:49 PM
Still nothing. Here is the link to my site so you can see what i am talking about. You can see the links in the frame to the left then the links above the div which i am trying to get to the left of the div.



http://georgeafi.bravepages.com/index2.html

georgeafi
03-21-2003, 04:02 PM
Ok I had enough of this did. I'm just going to try out table instead. I just wanted the div incase i ever needed a scroll bar but no big deal. Thanks for trying guys.

DaveSW
03-21-2003, 04:06 PM
http://www.emdevelopments.co.uk/georgafi/georgafi.htm

how about that?

georgeafi
03-21-2003, 04:12 PM
Thats loooks good. Is there a way of having the right part not go all the way to the edge of the sreen. The reason i wanted to move the stuff over is so i can have more on the page. You know what i mean?

DaveSW
03-21-2003, 04:15 PM
If you have another div, with a different class - i.e. images, and use the css to float it to the other side, the div will just line up in the center, as it will have two floated divs, one on either side, basically, copy the css for the .menu that i did, replace left with right, and you're away.

Glad you like it, dave :D

georgeafi
03-21-2003, 04:32 PM
Thanks man, its going to take awhile till get use to that. theres so much code and its not spread arounf like i do do it. Its hard to find some stuff. Lol. But i'll manage. Now i just have to put the links on all the other pages and fix those so everthing doesn't go to the bottom too. But those will be easy since thier all text and talbes. Thanks again man. You have no idea how relieved i am. lol

DaveSW
03-21-2003, 04:40 PM
I've remodified the link above with a div down the right hand side. it was a bit more difficult than i thought, and need a change from float to absolute positioning. Looks good now though...if i say so myself...

dave

georgeafi
03-21-2003, 04:55 PM
Ummmmm. i put in that new code and well see for yourself


http://georgeafi.bravepages.com/main.html

DaveSW
03-21-2003, 04:55 PM
I have a suggestion to make the code easier. How about a separate style sheet - take out all the css styles at the top, place them in notepad, and save the file a style.css. You can then use <LINK HREF="style.css" TYPE="text/css" REL="stylesheet" TITLE="W3C Core Styles: modernist" ID="sqstylesheet"> next to your title tag on the main page and hide a lot of the code. you can then reuse that link to the file on every page.

Hope that helps.

Dave

georgeafi
03-21-2003, 05:01 PM
I have no idea what you just said. I don't know anyhthing much about html, css, xhtml none of that stuff. Would it be ok to just have that first code you gave me? Having the updates g all the way to the edge of the screen is no big deal. I just want to make this as easy as posilbe.

DaveSW
03-21-2003, 05:13 PM
I can put it together for you tomorrow, (UK time) but heres my latest version

http://www.emdevelopments.co.uk/georgafi/georgafi2.htm

You basically had all your tags confused. HTML follows this structure:
html
head
title
styles and scripts
end head
body
end body
end html

A table would probably be easier for what you want.

Dave

DaveSW
03-21-2003, 05:21 PM
http://www.emdevelopments.co.uk/PPC/Main_Menu_page.htm is a small/simple page to give you the idea of how html lays out. use right click 'view source'.

You may be best off leaving the site in frames for the time being, and learning more about html before you attempt using more complex layouts etc.

dave

DaveSW
03-22-2003, 04:08 AM
http://www.emdevelopments.co.uk/georgafi/ here's the original