Jump to content

Content placement css help!


Recommended Posts

I need some help, my content seems to be in place how ever when is zoom in/out it moves out of place tried all these css trick position, wrap and width fix didnt work.


body {
    background: #1d0202 url("images/header_body.jpg") no-repeat    
    top center;
margin:0 auto;
font:13px/16px "Lucida Grande", Arial, Sans-serif;

.wrap {
width: 750px;
.row {  width: 200px;
margin: 0 auto;

#container {
//margin:0 auto;
position: absolute;
       top: 30%;
       width: 800px;
       margin-left: auto ;
       margin-right: auto ;




        <div id="container" class="wrap"> 
<table width='100%' border='0' align='center' cellspacing='0'>

        <form action="authenticate.php" class="gen-form" method="post">
        <input class="text-input" id="username" name="username" tabindex="1" type="text" onclick="this.value='';" onfocus="this.select()" onblur="this.value=!this.value?'Username...':this.value;" value="Username..." />

<input class="text-input" id="password" name="password" tabindex="1" type="password" onclick="this.value='';" onfocus="this.select()" onblur="this.value=!this.value?'Password...':this.value;" value="Password..." />

<input type="submit" class="button" value="" tabindex="3">


    <div class="content_body">

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.


<div class="register_button_padding">

 <input type="submit" class="register_button" value="" tabindex="3">



Link to comment
Share on other sites

Well, it depends on what you want to position, and where.

For centering an element horizontally, you can use:

elm {
   left: 0;right: 0;
   margin: 0 auto
   /** positioning could be set, depending on your needs **/


For centering an element horizontally and vertically:

In most browsers(if not all) the user-agent stylesheet applies some margins to the body and some elements on the document.

This will need to be reset on both elements you would like to use, e.g.: define it's margin on body.


body {
   margin: 0

elm {
   width: 200px;
   height: 200px;

   position: absolute;
   top: 0;left: 0;
   right: 0;bottom: 0;
   margin auto;

   /** also take into account borders and padding **/

   z-index: 1


To position an element left or right, without escaping the relativity of it's parent, you could use float.


elm {
      float: left

   /** or **/

   float: right
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...