Title: Div not expanding
Last modified: August 19, 2016

---

# Div not expanding

 *  [nickallain](https://wordpress.org/support/users/nickallain/)
 * (@nickallain)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/div-not-expanding/)
 * This one is a little tricky but it’s probably something simple or fundamental
   that I’ve overlooked. I may just be wrong about the way I’m using CSS positioning
   in the content of my page?
 * I’m working on a wordpress site for a friend. I have a page template file that
   basically says:
 * If this is the news page…
    … do the wordpress loop else … load the page contents.
 * On the news page, the site loads correctly:
    [http://nicholasallain.com/robertsite/org/?page_id=7](http://nicholasallain.com/robertsite/org/?page_id=7)
 * On any other page, the page ignores the content and draws the footer right under
   the header:
    [http://nicholasallain.com/robertsite/org/?page_id=15](http://nicholasallain.com/robertsite/org/?page_id=15)
 * Here’s my page content:
    [http://pastebin.com/pNf9D2La](http://pastebin.com/pNf9D2La)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [WillxD](https://wordpress.org/support/users/willxd/)
 * (@willxd)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/div-not-expanding/#post-1822138)
 * Hello,
 * Why don’t you create a new file CSS and separate the style of code?
 * The structure of the site is messy.
 *     ```
       <div id="wrap">
       <div id="header">
        your code here..
       </div>
   
       <div id="container">
   
       <div id="content">
        your code here..
       </div><!-- end content -->
   
       <div id="sidebar">
        your code here..
       </div><!-- end sidebar-->
   
       </div> <!-- end container -->
   
       <div class="clear"></div>
   
       <div id="footer">
       your footer code...
       </div><!--end footer-->
       </div><!-- end wrap -->
       ```
   
 * and create a style.css
 *     ```
       #wrap{
          width:1024px;
          margin:auto;
          }
       #header{
          .....
          }
   
       #content{
          padding:20px;
          ....
       }
   
       .clear{
          clear:both;
          }
   
       #footer{
        ....
       }
       ```
   
 * If you do a good structure of your site, its easier to find any mistake.
 *  Thread Starter [nickallain](https://wordpress.org/support/users/nickallain/)
 * (@nickallain)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/div-not-expanding/#post-1822139)
 * Thanks WillxD,
 * I’ve actually been doing that as I go along. I initially created a prototype 
   with all this messy code. I’ve cleaned up the rest of the pages – this is the
   last one to fix up.
 * I’m just weary of separating this all out then having to bounce between two files
   to find the issue.
 * I agree that the mess is part of the problem.
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/div-not-expanding/#post-1822140)
 * have you checked, if this
    `$pageid = $id;` in line 5 actually contains anything?
 * imho, this is unlikely;
    i would use something like: `$pageid = $post->ID;`
 *  [Root](https://wordpress.org/support/users/root/)
 * (@root)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/div-not-expanding/#post-1822141)
 * For my 2 cents that looks like uncleared floats. if u float one or more elements
   in a div you need to do something to bring the container down behind the floats
   otherwise subsequent content rides up. These days we add `width : xxx; overflow:
   hidden;` to the parent. But mixing yr html and CSS inline is a disaster.
 *  Thread Starter [nickallain](https://wordpress.org/support/users/nickallain/)
 * (@nickallain)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/div-not-expanding/#post-1822435)
 * Thanks everyone,
    Turns out I was using absolute positioning on the page contents(
   maincontent) where I should have been using relative. Turns out all I needed 
   was fresh eyes and some good pointers. 🙂 This issue is officially resolved.
 * alchymyth, strangely enough they both seem to work.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Div not expanding’ is closed to new replies.

## Tags

 * [css](https://wordpress.org/support/topic-tag/css/)
 * [positioning](https://wordpress.org/support/topic-tag/positioning/)
 * [template](https://wordpress.org/support/topic-tag/template/)

 * 5 replies
 * 4 participants
 * Last reply from: [nickallain](https://wordpress.org/support/users/nickallain/)
 * Last activity: [15 years, 4 months ago](https://wordpress.org/support/topic/div-not-expanding/#post-1822435)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
