Problem with css content box made from divs and background images

This is a discussion on "Problem with css content box made from divs and background images" within the Web Page Design section. This forum, and the thread "Problem with css content box made from divs and background images are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 9th, 2007, 21:42
Up'n'Coming Member
Join Date: Jul 2007
Location: England
Posts: 67
Blog Entries: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Problem with css content box made from divs and background images

Hi gang,

You all should remember me after turning me against tables and into a CSS junky... lol

Well, based on an example I was given by Lchad I beleive.
I have been developing a simple css layout.

What I have done is visable in the image below:


This is only a mock up using quick graphics to give me a something visual I can see to work on.
The image above looks okay but watch what happens when the paragraph tags are used in the content area:



The html code for that section is here:
Code: Select all
  <div id="sidebar">
        <div id="top_left_box"></div>
<div id="center_content_box">
  <p>This is content box Left..</p>
  <p>&nbsp;  </p>
</div>
<div id="bottom_left_box"></div>
  </div>
The CSS that controls it is here:
Code: Select all
/* SIDE BAR OR CONTENT BOX 1 */    
    
    #sidebar {
        float: left;
        width: 260px; /* real width: 280px; */
        padding-top: 7px;
        padding-bottom: 7px;
        padding-left:5px;
    }
      
/* START OF BACKGROUND BOX 1 GRAPHICS */      
      
    #top_left_box{
      height: 32px;
      background-image: url(../images/left-box_top.gif); background-repeat: no-repeat; background-position: left;
    }
      
    #center_content_box{
    height: auto;
      background-image: url(../images/left-box_center.gif); background-repeat: repeat-y; background-position: left;
      padding-left: 20px;
      padding-right:20px;
    }
      
    #bottom_left_box{
      height: 34px;
      background-image: url(../images/left-box_bottom.gif); background-repeat: no-repeat;    background-position: left;
    }
    
    
/* END OF BOX GRAPHICS */
/* END OF SIDEBAR */
If I use the <br /> tags I dont get a problem with the images breaking appart.

Can any one help or advise please.

Thanks
Last Blog Entry: Fire In The Hole! (Jan 23rd, 2008)

Last edited by weasel; Aug 9th, 2007 at 21:45.
Reply With Quote

  #2 (permalink)  
Old Aug 9th, 2007, 22:08
SuperMember

SuperMember
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Problem with css content box made from divs and background images

Try setting margins to 0 on you p's in the css. Use padding instead, might work.

Pete.
Reply With Quote
  #3 (permalink)  
Old Aug 9th, 2007, 22:13
SuperMember

SuperMember
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Problem with css content box made from divs and background images

Use this in your css
Code: Select all
* {
margin: 0;
padding: 0;
}
That will erase the padding that the p's are getting.
Reply With Quote
  #4 (permalink)  
Old Aug 9th, 2007, 22:48
Up'n'Coming Member
Join Date: Jul 2007
Location: England
Posts: 67
Blog Entries: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Problem with css content box made from divs and background images

Worked a charm! Thanks very much!!!!!!!!1
Last Blog Entry: Fire In The Hole! (Jan 23rd, 2008)
Reply With Quote
Reply

Tags
background, content, css, divs, images

Thread Tools

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS - floating divs and images help Emzi Web Page Design 8 May 29th, 2008 17:58
IE6 Problem with navigation background images Lchad Web Page Design 6 May 1st, 2007 18:55
Divs and floating images AdRock Web Page Design 7 Mar 28th, 2007 10:48
someone check my website - just made - fix my problem? cheeky Web Page Design 7 Aug 1st, 2006 14:04
css div percentages and loading content in specific divs antonyx Web Page Design 3 Dec 24th, 2005 15:45


All times are GMT. The time now is 21:09.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43