WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Site Design > Graphics & Design Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Graphics & Design Discussion Forum Post your graphics design questions/comments/ideas in here. Ask questions, post tutorials, discuss trends and best practices. Sub-forum for website accessibility and usability.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-18-2005, 11:51 PM
WebProWorld Member
 

Join Date: Dec 2004
Location: Calcutta
Posts: 70
souvik das RepRank 0
Default Positioning a div layer

HI
I am having a problem with layer in dreamweaver. I have
made a layer & inside it there is a form & a button. I have used CSS in both form & button. But the problem is that, in "1024" resolution The alignment of layer is perfect. But when I am making the screen resolution "800* 600" it is getting dealigned. It is going right side of the screen.

my question is that how can I keep the layer in its place ?

Please suggest me.

---------Souvik das-----------
__________________
I want to know about how to design the search engine friendly websites with attractive graphics.
Reply With Quote
  #2 (permalink)  
Old 04-19-2005, 09:56 AM
paulhiles's Avatar
WebProWorld 1,000+ Club
 

Join Date: Jul 2003
Location: UK
Posts: 2,803
paulhiles RepRank 0
Default CSS centering of a div element

Do you have a sample page to view? Or alternatively, a snippet of your CSS and the relevant section of HTML code?

The problem sounds like it could be an issue with absolute positioning and/or margin widths, but it's difficult to tell without seeing your code. Have you tried using "position: relative;" for your div's position and "margin: auto;" for the margin width?

Take a look at this excellent tutorial on CSS centering at the Quirksmode.org site.

Paul
Reply With Quote
  #3 (permalink)  
Old 04-20-2005, 12:35 AM
WebProWorld Member
 

Join Date: Dec 2004
Location: Calcutta
Posts: 70
souvik das RepRank 0
Default as you asked

hi paulhiles

Have a look in the codes as you asked me

<div id="Layer1" style="position:absolute; width:208px; height:27px; z-index:1; left: 684px; top: 9px;">
__________________
I want to know about how to design the search engine friendly websites with attractive graphics.
Reply With Quote
  #4 (permalink)  
Old 04-20-2005, 05:02 AM
paulhiles's Avatar
WebProWorld 1,000+ Club
 

Join Date: Jul 2003
Location: UK
Posts: 2,803
paulhiles RepRank 0
Default A little more info please

By setting the div's position as absolute, you've permanently fixed it's position in relation to the rest of the page. So when a visitor adjusts or resizes their browser that div will just stay exactly where it is... i.e. 684 pixels from the left-hand side of the browser window.

Could you provide some of the actual HTML code? You mentioned a form and button in your original post. Also, how does the div fit in with other page elements around it? Have you nested the div inside of another div or possibly a table cell?

Paul
Reply With Quote
  #5 (permalink)  
Old 04-20-2005, 05:51 AM
WebProWorld Member
 

Join Date: Dec 2004
Location: Calcutta
Posts: 70
souvik das RepRank 0
Default here is a demo problem

Just copy the code & run it in 1024 resolution next run the same code in 800*600 resolution. You will see the diffrence.

------------Souvik das------------------------------

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>

<body>
<div id="Layer1" style="position:absolute; left:571px; top:21px; width:235px; height:30px; z-index:1">
<input type="text" name="textfield" />
<input type="submit" name="Submit" value="Submit" />
</div>
<table width="750" height="49" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th width="423" bgcolor="#999999" scope="row">Souvik das Souvik das </th>
<th width="327" bgcolor="#999999" scope="row"> </th>
</tr>
</table>
</body>
__________________
I want to know about how to design the search engine friendly websites with attractive graphics.
Reply With Quote
  #6 (permalink)  
Old 04-20-2005, 07:20 AM
paulhiles's Avatar
WebProWorld 1,000+ Club
 

Join Date: Jul 2003
Location: UK
Posts: 2,803
paulhiles RepRank 0
Default Nest the div inside a table cell

If you place your div layer inside of the right hand table cell, replace the "absolute" position with "relative", then you can float the div to the right.

The coding is far from ideal, but it's largely based on your demo sample above. You could achieve all of this with just div elements if you wished.

<body>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th width="423" bgcolor="#999999" scope="row">Souvik das Souvik das </th>
<th width="327" bgcolor="#999999" scope="row">
<div id="Layer1" style="position:relative; float:right; margin: 0.8em; width:235px; height:30px; z-index:1">
<form action="" id="form1" method="post" name="form1">
<input type="text" name="textfield" />
<input type="submit" name="Submit" value="Submit" />
</form>
</div>
</th>
</tr>
</table>
</body>
Reply With Quote
  #7 (permalink)  
Old 04-20-2005, 07:56 AM
WebProWorld Member
 

Join Date: Dec 2004
Location: Calcutta
Posts: 70
souvik das RepRank 0
Default Something related

cool ...... its working thanks !!!

But when I am putting that layer on an image its not working. Its again the same.

I mean:---------
insert an image> draw a layer on that particular image> inside that layer...... The form & the button.

"The same problem inspite of your last code"
__________________
I want to know about how to design the search engine friendly websites with attractive graphics.
Reply With Quote
  #8 (permalink)  
Old 04-20-2005, 08:10 AM
paulhiles's Avatar
WebProWorld 1,000+ Club
 

Join Date: Jul 2003
Location: UK
Posts: 2,803
paulhiles RepRank 0
Default

Are you trying to add image buttons for your form?
Or are you adding a background-image to the div itself?

Either way, it shouldn't alter the layout... maybe the images need to be resized or you might want to increase the size of the div allowing the images to fit.

Paul
Reply With Quote
  #9 (permalink)  
Old 04-20-2005, 08:17 AM
WebProWorld Member
 

Join Date: Dec 2004
Location: Calcutta
Posts: 70
souvik das RepRank 0
Default This is the thing i want to do

This is the thing I want to do...& you will see the difference in 1024 & 800*600.



<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>

<body>
<div id="Layer1" style="position:absolute; left:542px; top:17px; width:211px; height:19px; z-index:1">
<input type="text" name="textfield" />
<input type="submit" name="Submit" value="Submit" />
</div>
[img]file:///D|/Documents%20and%20Settings/ABC/My%20Documents/Unnamed%20Site%201/cashadvance-care-revised.jpg[/img]</body>
</html>
__________________
I want to know about how to design the search engine friendly websites with attractive graphics.
Reply With Quote
  #10 (permalink)  
Old 04-20-2005, 08:40 AM
paulhiles's Avatar
WebProWorld 1,000+ Club
 

Join Date: Jul 2003
Location: UK
Posts: 2,803
paulhiles RepRank 0
Default

Okay, well that's different again!
First things first...
You're referencing an image that's on your local machine, so no-one except you can see it.
The div is now using absolute positioning again, and isn't related to any other object... and the image just seems to have been randomly inserted.

To be honest, I think you need to work through some HTML tutorials and improve your overall knowledge. This will help when faced with similar layout problems in the future.

Paul
Reply With Quote
Reply

  WebProWorld > Site Design > Graphics & Design Discussion Forum
Tags: , ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0