Solved

Separating DIVS apart from each other in CSS

Posted on 2008-06-24
5
245 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Jump links not quite lining up 18 49
pic in header needs to resize on mobile 4 53
Css issue on scroll 1 17
Problem to page 4 16
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this Micro Tutorial users will learn how to embed custom fonts into websites using @font-face in CSS Select a font: Ensure the EULA allows you to use @font-face: Download the font: Get the browser-compatible files you need: Edit your CSS       - Name …
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now