Jump to content

IE 6 border issue


fierdor

Recommended Posts

I have two divs one nested inside the other...I apply a border to both divs....

 

In IE6 I see a border around the entire parent div and a border around the child div

In Firefox I see 2 disjoint divs,both bordering the respective text in the divs..

I have attached images

 

Sample code:

<div id="parent" style="border:1px solid #456"
Some text
                <div id="child" style="border:1px solid #456">
                 Some text
                </div>
</div>

 

So is there a solution to the IE6 problem?

 

[attachment deleted by admin]

Link to comment
Share on other sites

Ok here it is:

<html>
<head>
<style>
#wrapper {

width:856px;
background-color: #ffffff;
height:700px;
margin:auto;

}

#child1 {
position:relative;
width:360px;	
height:250px;
left:-20px;
color:#000;
text-align:center;
}

#parent{
width:400px;
height:250px;
float:left;
position:relative;
    left:50px;
    border:1px solid #06f;

    }

#child2
{

float:left;
width:400px;
position:relative;
border:1px solid #06f;
}



</style>
</head>
<body>
<div id="wrapper">
<div id="parent">
<h4>Parent</h4>
<div id="child1">
Child 1</div>
<div id="child2">
<h4>Child 2</h4>
</div>
</div>
</div>
</body>

 

I was just trying to post the relevant code previously..

Anyways now i am beginning to understand the nuances of CSS and how some properties affect others drastically..

Will keep that in mind before posting in the future..

Sorry if I have wasted your time

 

The above code recreates my exact problem...

Link to comment
Share on other sites

No I have..See near child 1..

I have indented the code here:

<html>
<head>
<style>
#wrapper {

width:856px;
background-color: #ffffff;
height:700px;
margin:auto;

}

#child1 {
position:relative;
width:360px;	
height:250px;
left:-20px;
color:#000;
text-align:center;
}

#parent{
width:400px;
height:250px;
float:left;
position:relative;
    left:50px;
    border:1px solid #06f;

    }

#child2
{

float:left;
width:400px;
position:relative;
border:1px solid #06f;
}



</style>
</head>
<body>
<div id="wrapper">
<div id="parent">
	<h4>Parent</h4>

		<div id="child1">
		Child 1
		</div>

		<div id="child2">
		<h4>Child 2</h4>
		</div>	

</div>
</div>
</body>

Link to comment
Share on other sites

Alright, now that we've got your code, you want IE6 to look like firefox I'm guessing?

 

First thing, get rid of all the relative positioning. Use left margins if you want a left margin. You can get rid of your left declarations as well, since they won't have any effect once the positioning is not relative anymore. That should probably do it for you.

Link to comment
Share on other sites

Ok I tried that...The problem persists..My code now looks like this:

 

<html>
<head>
<style>
#wrapper {
   
   width:856px;
   background-color: #ffffff;
   height:700px;
   margin:auto;
   }

#child1 {
   width:360px;   
   height:250px;
   color:#000;
   text-align:center;
}
   
#parent{
   width:400px;
   height:250px;
   margin-left:50px;
   border:1px solid #06f;
    }

#child2
{
width:400px;
border:1px solid #06f;
}



</style>
</head>
<body>
<div id="wrapper">
   <div id="parent">
      <h4>Parent</h4>
         
         <div id="child1">
         Child 1
         </div>
   
         <div id="child2">
         <h4>Child 2</h4>
         </div>   
         
   </div>
</div>
</body>

 

Link to comment
Share on other sites

<div class="box">
  <h2>Header of box 1</h2>
  <p>Content of box 1</p>
</div>

[code]<div class="box">
  <h2>Header of box 2</h2>
  <p>Content of box 2</p>
</div>

 

.box

{

  border:solid black 1px;

}[/code]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.