Current location: Hot Scripts Forums » General Web Coding » HTML/XHTML/XML » putting boxes next to each other without space between


putting boxes next to each other without space between

Reply
  #1 (permalink)  
Old 08-15-09, 06:45 PM
Benjaminss Benjaminss is offline
New Member
 
Join Date: Aug 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
putting boxes next to each other without space between

putting boxes next to each other with out space between

--------------------------------------------------------------------------------

Hi all,

I'm a beginner with XHTML, creating my very first website, so please forgive me if this should be a stupid question:

I crated a table with 6 colums. Each column has a border. I'd like to set the 1st column on the left side, and the other 5 columns without a space between them on the right side. But there is still space between them. What am I doing wrong?? By the way - the 5 colums on the right side contain pictures. They are supposed to be in the middle with the same distance around to the border - doesn't work either ... the picture stucks at the top - but at least horizontally in the middle ...
HTML Code:
<TABLE style="cellpadding:0; cellspacing:0; width:85em;">
<TR>
<TD>
<DIV style="float:left; 
background-color:#f5f5f5; 
border:1px solid #CC6699; 
width:10em; height:5em; 
text-align:left;">
<B>text</B>
</DIV>
</TD> 
<TD>
<DIV style="float:right;
border:1px solid #CC6699; 
width:10em; height:5em; 
text-align:center; 
vertical-align:middle; 
display:table-cell;">
<IMG style="align:center; 
width:9em; 
height:4em;" 
src="path" 
alt="PICTURE">
</DIV>
</TD> 
<TD>
<DIV style="float:right;
border:1px solid #CC6699;
width:10em; height:5em; 
text-align:center; 
vertical-align:middle; 
display:table-cell;">
<IMG style="align:center; 
width:9em; 
height:4em;"
src="path" 
alt="PICTURE">
</DIV>
</TD>
<TD>
<DIV style="float:right;
border:1px solid #CC6699;
width:10em; height:5em; 
text-align:center; 
vertical-align:middle; 
display:table-cell;">
<IMG style="align:center; 
width:9em; 
height:4em;" 
src="path" 
alt="PICTURE">
</DIV>
</TD>
<TD>
<DIV style="float:right;
border:1px solid #CC6699; 
width:10em; height:5em; 
text-align:center; 
vertical-align:middle; 
display:table-cell;">
<IMG style="align:center; 
width:9em; 
height:4em;" 
src="path" 
alt="PICTURE">
</DIV>
</TD> 
<TD>
<DIV style="float:right; 
border:1px solid #CC6699; 
width:10em; height:5em; 
text-align:center; 
vertical-align:middle; 
display:table-cell;">
<IMG style="align:center; 
width:9em; 
height:4em;" 
src="path" 
alt="PICTURE">
</DIV>
</TD>
<TD>
<DIV style="float:right; 
border:1px solid #CC6699; 
width:10em; height:5em; 
text-align:center; 
vertical-align:middle; 
display:table-cell;">
<IMG style="align:center; 
width:9em; 
height:4em;" 
src="path" 
alt="FLAG OF CHILE">
</DIV>
</TD> 
</TR>
</TABLE>

Last edited by Nico; 08-16-09 at 01:21 PM.
Reply With Quote
  #2 (permalink)  
Old 08-24-09, 09:29 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
I'd change:

HTML Code:
<DIV style="float:left; 
background-color:#f5f5f5; 
border:1px solid #CC6699; 
width:10em; height:5em; 
text-align:left;">
to

HTML Code:
<style type="text/css">
body
{
padding:0;
margin:0;
}
x {
float:left; 
background-color:#f5f5f5; 
border:1px solid #CC6699; 
width:10em; height:5em; 
text-align:left;
}
</style>
</head>
<body>
<div class="x">
Content
</div>
</body>
Note the padding and margin settings - they may be helpful.
Reply With Quote
  #3 (permalink)  
Old 08-25-09, 03:05 AM
DaiLaughing DaiLaughing is offline
Newbie Coder
 
Join Date: Jul 2009
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by wirehopper View Post
I'd change:

x {
There should be a dot at the start of that line.

Margin:0px is the simple answer.
Reply With Quote
  #4 (permalink)  
Old 08-25-09, 07:42 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
You are correct DaiLaughing. Good catch.
Reply With Quote
  #5 (permalink)  
Old 09-04-09, 06:44 AM
aburrows182 aburrows182 is offline
Newbie Coder
 
Join Date: Jul 2004
Location: Ashtead, Surrey, UK
Posts: 61
Thanks: 0
Thanked 1 Time in 1 Post
Don't structure a website with tables! It should only be used for tabular data.By putting a div within a table cell you are defeating the point of divs.
Reply With Quote
  #6 (permalink)  
Old 09-04-09, 06:57 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
Quote:
Originally Posted by aburrows182 View Post
Don't structure a website with tables! It should only be used for tabular data.By putting a div within a table cell you are defeating the point of divs.
Not necessarily, div's can be used for some very fancy formatting inside table cells.
__________________
Jerry Broughton
Reply With Quote
  #7 (permalink)  
Old 09-04-09, 08:10 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
Try it like this:
HTML Code:
<style>
.left_div
{
 float:left;
 width:10em;
 height:4em;
 background:#f5f5f5;
 border:1px solid #CC6699;
 padding:.5em;
 }
.left_center_div
{
 height:4em;
 }
.right_div
{
 float:right;
 border:1px solid #CC6699;
 height:4em;
 padding:.5em;
 }
.image
{
 width:9em;
 height:4em;
 }
</style>
<div class="left_div">
 <div class="left_center_div"><B>text</B></div>
</div>
<div class="right_div"><IMG class="image" src="path" alt="PICTURE1"><IMG class="image" src="path" alt="PICTURE2"><IMG class="image" src="path" alt="PICTURE3"><IMG class="image" src="path" alt="PICTURE4"><IMG class="image" src="path" alt="PICTURE5"><IMG class="image" src="path" alt="FLAG OF CHILE"></div>
__________________
Jerry Broughton
Reply With Quote
Reply

Bookmarks

Tags
div, html, space, table, xhtml


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Space Above Form xavier039 CSS 1 07-13-09 10:52 PM
[selling]Banner space, Link Space lilgee Traffic Exchange 0 12-02-05 10:06 PM
RESELLER WEB SPACE - $9.99/MONTH For 4GB HD & 30GB BW TO $49.99/mo 25GB HD & 250GB BW IncognitoNet General Advertisements 0 12-01-05 09:01 AM
New marketplace for buying and selling advertising space opens ad-bay General Advertisements 0 06-15-05 11:27 PM
One Week Special - 50% Extra Hosting Space - www.deasoft.com bjdea1 General Advertisements 0 06-16-04 05:23 AM


All times are GMT -5. The time now is 09:07 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.