User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the HTML and CSS section within the Web Development category of DaniWeb, a massive community of 402,811 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,066 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Views: 618 | Replies: 5
Reply
Join Date: Jul 2008
Posts: 1
Reputation: karysma is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
karysma karysma is offline Offline
Newbie Poster

Div wont position properly

  #1  
Jul 14th, 2008
Good Day.

My div will not position properly. Rather, it just sits in the top-left corner. I have tried z-index with no luck. The first Div represents the background for my page, and the div inside of that is supposed to be positioned inside the message box on the background.

Any help is appreciated. Thanks.

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
  <title>Rise & Flow | Flow & Rise</title>
</head>

<body>
<center>
<div style="background : url(http://i21.photobucket.com/albums/b253/karysmatik/rflowhome.jpg); border:#000000 3px SOLID; color:#ffffff; width:1024px;height:768px; z-index: 2;">

<div style="position:absoute; top:500; left:500; width:100; height:100; border:#000000 3px SOLID; color:#ffffff">DZHZDFHZDHZDGHZDGHZZGNFGNFNCONTENT</div>
  

</div>

</center>


</font>
</div>



</body>

</html>

AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2008
Location: Hyderabad, India
Posts: 258
Reputation: sreein1986 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 27
sreein1986's Avatar
sreein1986 sreein1986 is offline Offline
Posting Whiz in Training

Re: Div wont position properly

  #2  
Jul 15th, 2008
give the alignment
Thanx,
Sreekanth

www.saap.in
if you problem solved add me as a reputation and mark it mark as solved
Reply With Quote  
Join Date: Jan 2008
Location: Bali - Indonesia
Posts: 61
Reputation: rudevils is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 8
rudevils rudevils is offline Offline
Junior Poster in Training

Re: Div wont position properly

  #3  
Jul 15th, 2008
Try to remove "position:absolute" and the attributes. Use padding and margin to manage your div position. MMM maybe something like this

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
  <title>Rise & Flow | Flow & Rise</title>
</head>

<body>
<center>
<div style="background : url(http://i21.photobucket.com/albums/b253/karysmatik/rflowhome.jpg); border:#000000 3px SOLID; color:#ffffff; width:1024px;height:768px; z-index: 2;">

<div style="margin-top:500px; margin-left:500px; width:100px; height:100px; border:#000000 3px SOLID; color:#ffffff">DZHZDFHZ DHZDGHZD GHZZGNF GNFN CONTENT</div>
  

</div>

</center>


</font>
</div>



</body>

</html>
Last edited by rudevils : Jul 15th, 2008 at 12:54 am. Reason: add content
If love is blind, why there's a bikini ??

Post your article at Bali Side Notes share your knowledge
Reply With Quote  
Join Date: Jan 2007
Posts: 2,537
Reputation: MidiMagic is on a distinguished road 
Rep Power: 7
Solved Threads: 111
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Posting Maven

Re: Div wont position properly

  #4  
Jul 18th, 2008
Quoted items don't always work across line breaks in tags. You have styles that take up three lines. Make a stylesheet style for those. You can have line breaks in a stylesheet.
Daylight-saving time uses more gasoline
Reply With Quote  
Join Date: Jul 2008
Posts: 4
Reputation: shadow_cool is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
shadow_cool shadow_cool is offline Offline
Newbie Poster

Re: Div wont position properly

  #5  
Jul 18th, 2008
Don't use abslute position. Try to the second div to white clear:both ad left margin:500px. i think it's work, but i dont know what u want to make
Reply With Quote  
Join Date: Jun 2008
Posts: 67
Reputation: Troy III is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 10
Troy III's Avatar
Troy III Troy III is offline Offline
Junior Poster in Training

Re: Div wont position properly

  #6  
Jul 19th, 2008
Good day, karysma.
Your code had a few errors marked with red.

Originally Posted by karysma View Post
Good Day.

My div will not position properly. Rather, it just sits in the top-left corner. I have tried z-index with no luck. The first Div represents the background for my page, and the div inside of that is supposed to be positioned inside the message box on the background.

Any help is appreciated. Thanks.

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
  <title>Rise & Flow | Flow & Rise</title>
</head>

<body>
<center>
<div style="background : url(http://i21.photobucket.com/albums/b253/karysmatik/rflowhome.jpg); border:#000000 3px SOLID; color:#ffffff; width:1024px;height:768px; z-index: 2;">

<div style="position:absoute; top:500; left:500; width:100; height:100; border:#000000 3px SOLID; color:#ffffff">DZHZDFHZDHZDGHZDGHZZGNFGNFNCONTENT</div>

</div>

</center>


</font>
</div>


</body>

</html>




Solution:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
  <title>Rise & Flow | Flow & Rise</title>
</head>

<body>
 <center>
   <div style="background : url(http://i21.photobucket.com/albums/b253/karysmatik/rflowhome.jpg); border:#000000 3px SOLID; color:#ffffff; width:1024px;height:768px; ">
     <div style="position: absolute; top:500; left:500; width:100; height:100; border:#000000 3px SOLID; color:#ffffff">DZHZDFHZDHZDGHZDGHZZGNFGNFNCONTENT</div>
   </div>
 </center>

</body>
</html>

Report:
1. There was a typing error in "position" declaration "absoute"
2. z-Index is not needed for absolutely positioned elements to come into view, -they get on top of all nonpositioned elements by default.
3. Few other closures for elements which are not opened: "</font> </div>" removed.

Regards.
Last edited by Troy III : Jul 19th, 2008 at 4:55 am.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb HTML and CSS Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the HTML and CSS Forum

All times are GMT -4. The time now is 11:00 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC