Solved

Separating DIVS apart from each other in CSS

Posted on 2008-06-24
5
248 Views
Last Modified: 2012-08-14
hi, I'm developing an ASP.NET site and using custom controls for rounded rectangles to put stuff in on my pages. everything works in IE fine. pretty much everything works in firefox, apart from on my home page.

i have two of these controls, each in different divs, with the idea of having two rectangles on each half of the webpage (left and right). Im using a "separation" div to separate the two apart:

#separator {
      float: left;
      width: 3%;
}

IE accepts this and renders everything correctly, but FF places the first div immediately to the right of the second, ignoring the 3% gap i want between the two. any ideas how to fix this?
0
Comment
Question by:chris_smith_51
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:codeQuantum
ID: 21860374
It depends on so many things... we need more information.

In the meantime, try this code :
#separator {
      float: left;
      width: 3%;
      display: block;
}

Open in new window

0
 
LVL 2

Author Comment

by:chris_smith_51
ID: 21860456
thanks but no luck unfortunately.
what info do you need exactly? maybe the css of the divs themselves? im dealing with so much code i dont want to post irrelevant info. but maybe this is helpful:


#body-left {
	float: left;
	width: 30%;
}
 
#separator {
	float: left;
	width: 3%;
	display: block;
}
 
#body-center {
	float: left;
	width: 30%;
}

Open in new window

0
 
LVL 5

Accepted Solution

by:
codeQuantum earned 30 total points
ID: 21860506
A sample of the HTML code would be helpful too. What is inside the separator?

It might be because the separator is empty. Try using   inside.
0
 

Assisted Solution

by:icedesignstudios
icedesignstudios earned 20 total points
ID: 21860528
An easier solution would be to apply a margin on one of the rectangles. This would save a little bit of code, and you would have one less <div> element. I tested the code out below and it renders the same in Firefox and Explorer.

What it does is apply a 3% margin-right to the div on the left, so the the other rectangle does line up next to it.

Hope that helps =)
<style type="text/css">
<!--
#body-left {
        float: left;
        width: 30%;
		margin-right: 3%;
}
 
#body-center {
        float: left;
        width: 30%;
}
-->
</style>

Open in new window

0
 
LVL 2

Author Closing Comment

by:chris_smith_51
ID: 31470370
thanks for the responses. it was because nothing was inside the separator div. the last solution was more elegant though so i hope you are happy with the point split. :)
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
.php tree directory? 5 72
Message not shown 5 50
Best way to minify CSS with out breaking it 7 35
How to create a textarea which saves text in HTML 8 37
"I want to put my photos online, but I don't want them stolen.  What settings should I use?" When You Put Photos Online First and foremost, any digital file published on the WWW can be copied, stored, modified, retransmitted, etc.  Remember Naps…
CSS3 Custom checkboxes This article shows how to style the checkbox form element using only CSS. Works in: Chrome, FF, Safari, Opera, IE9+ Uses modernizr.js to check for :checked pseudo class, falling back to plain old checkboxes (IE8 and bel…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question