473,378 Members | 1,496 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Div not terminating properly.

CES
All,
I'm not sure what's causing the problem in FireFox so I'm not sure what to ask...

I'm trying to put a boarder around some text… the problem is that instead of only surrounding the Div <div class="dR4C1"> the boarder extends from the bottom of the <div> to the top of the page. I know it’s an issue with the Div, because if I set the “border:3px double #B5B6B5” to “background color:red;” I have the same problem.

I’ve been working with this all evening thinking that I’ve missed putting in a semicolon or a quotation mark but the code looks correct and this is such a 101 example that theirs not much that could be wrong.

Also I was also wondering is their a way of creating an automatic/expandable boarder that will only surround what text is within the Div, by that I mean if you don’t include a specific width in the CSS the boarder takes up the entire Div. I’ve tried setting the width to auto but that doesn’t seem to work.

If anyone has a clue I would be grateful. Thanks in advance. – CES
<head>
<style type="text/css">
body, div, span, p, form, lable
{
margin:0;
padding:0;
}

body
{
text-align:center;
}

.dContentFrame
{
width:670px;
margin: 0 auto 0 auto;
}

.dR3C1,.dR3C2,.dR3C3
{
float:left;
width:330px;
height:100px;
}

.dR3C2
{
width:10px;
}

.dR4
{
padding:5px 0 5px 0;
}

.dR4C1
{
width:600px;
margin:5px auto 5px auto;
text-align:center;
border:3px double #B5B6B5;
}
</style>
</head>
<body>
<div class="dContentFrame">
<div class="dR3">
<div class="dR3C1">
Some Data
</div>
<div class="dR3C2">
</div>
<div class="dR3C3">
Some Data
</div>
</div>
<div class="dR4" style="">
<div class="dR4C1">
This is where the box/boarder should be
</div>
</div>
</div>
</body>
Feb 19 '06 #1
4 1443
Hi,

The problem seems to be with:
.dR3C1,.dR3C2,.dR3C3
{
float:left;
width:330px;
height:100px;
}


When I remove the float, height, or width (individually) the double border
behaves as you want, surrounding only the text within the <div>. Also,
adding "clear: both" to .dR4C1 also solves the problem without making any
changes to the above <div>'s. So, could the problem be with the float? I'm
not exactly sure.

But there are a couple of other things.

1) No doctype.

2) In .dContentFrame you specify a width of 670px, but the above three
div's are side-by-side and specified to 330px *each* totalling 990px, which
is wider than the 670px in .dContentFrame.

I thought that item #2 could be the main cause of the problem, but even
reducing the width to 200px, which makes them smaller than the 670px of
their container, doesn't make the border "behave".

So I'm not exactly sure why, but my experiments show that removing the float
or height in the 3 "dr3c" divs makes the border of "dr4c1" behave as you
want. If it doesn't affect any other code, I'd add the clear: both to dr4c1.

Maybe someone else will come along with a better answer/explanation.

Hope this helps a bit.

--
Viken K.
http://home.comcast.net/~vikenk
Feb 19 '06 #2
jim
CES:
I determined that the float:left property applied to .dR3C3 is the
culprit; why this is, I'm not sure; but
having the float applied will keep the border out of alignment.
..dR3C3 {
float:left; <--OMIT and border will be realigned as intended
width:330px;
height:100px;
}

-Jim

Feb 19 '06 #3

CES wrote:
I'm trying to put a boarder around some text... the problem is that instead
of only surrounding the Div <div class="dR4C1"> the boarder extends from
the bottom of the <div> to the top of the page. I know it's an issue with the
Div, because if I set the "border:3px double #B5B6B5" to "background
color:red;" I have the same problem.

.dContentFrame
{
width:670px;
Fixed width :-(
margin: 0 auto 0 auto;
Same as margin: 0 auto;
}

.dR3C1,.dR3C2,.dR3C3
Are these meaningful class names? Would they still tell you what was in
the divs if you changed the layout totally?
{
float:left;
width:330px;
height:100px;
}

.dR3C2
{
width:10px;
}
Why do I get the feeling that dR3C2 is too narrow to hold any content
and would be better handled as a margin on some other element?
.dR4
{
padding:5px 0 5px 0;
}
Same as padding: 5px 0;
.dR4C1
{
width:600px;
margin:5px auto 5px auto;
Same as margin: 5px auto;
text-align:center;
border:3px double #B5B6B5;
}
</style>
</head>
<body>
<div class="dContentFrame">
<div class="dR3">
<div class="dR3C1">
Some Data
</div>
<div class="dR3C2">
</div>
<div class="dR3C3">
Some Data
</div>
</div>
<div class="dR4" style="">
<div class="dR4C1">
This is where the box/boarder should be
</div>
</div>
</div>


Mmmmm, div soup.

Add clear: left to the styles for d4R4C1. Otherwise the div starts at
the top of the floated divs (though as there is no room for text up
there, the text doesm't start until below the floats.

Steve

Feb 19 '06 #4
CES
Steve Pugh wrote:
CES wrote:
I'm trying to put a boarder around some text... the problem is that instead
of only surrounding the Div <div class="dR4C1"> the boarder extends from
the bottom of the <div> to the top of the page. I know it's an issue with the
Div, because if I set the "border:3px double #B5B6B5" to "background
color:red;" I have the same problem.

.dContentFrame
{
width:670px;


Fixed width :-(
margin: 0 auto 0 auto;


Same as margin: 0 auto;
}

.dR3C1,.dR3C2,.dR3C3


Are these meaningful class names? Would they still tell you what was in
the divs if you changed the layout totally?
{
float:left;
width:330px;
height:100px;
}

.dR3C2
{
width:10px;
}


Why do I get the feeling that dR3C2 is too narrow to hold any content
and would be better handled as a margin on some other element?
.dR4
{
padding:5px 0 5px 0;
}


Same as padding: 5px 0;
.dR4C1
{
width:600px;
margin:5px auto 5px auto;


Same as margin: 5px auto;
text-align:center;
border:3px double #B5B6B5;
}
</style>
</head>
<body>
<div class="dContentFrame">
<div class="dR3">
<div class="dR3C1">
Some Data
</div>
<div class="dR3C2">
</div>
<div class="dR3C3">
Some Data
</div>
</div>
<div class="dR4" style="">
<div class="dR4C1">
This is where the box/boarder should be
</div>
</div>
</div>


Mmmmm, div soup.

Add clear: left to the styles for d4R4C1. Otherwise the div starts at
the top of the floated divs (though as there is no room for text up
there, the text doesm't start until below the floats.

Steve


All,
I'm sorry for the stupid question... I keep forgetting the clear:reference.
Thank - CES
Feb 19 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Earl Eiland | last post by:
I'm running a PyWin program that executes another program using subprocess.Popen(). Unfortunately, this other program isn't well behaved, and frequently terminates without terminating its process....
2
by: Byron | last post by:
I'm new to C# and threading, so hopefully this is a simple newbie question. I have a form that is supposed to listen for network traffic on a given port and decode and display any interesting...
8
by: lasek | last post by:
Hi all, a simple question, look at this code below: char acName="Claudio"; unsigned int uiLen; uiLen=strlen(acName); printf("Length of acName variable %u",uiLen); //uiLen >>>> 7
5
by: Xarky | last post by:
Hi, I am creating a windows form, and when a specified event occurs (button click), I am hiding the windows form and opening a new windows form. When opening the new windows form and closing...
2
by: Dave | last post by:
I have an application that queries SQL Server and Index Server using ADO. I'd like to have a feature where a user can cancel a long-running query. What I plan on doing is to move my query code to a...
23
by: Adam Clauss | last post by:
I have a C# Windows Service running as the NetworkService account because it needs to access a network share. As part of the service's initialization, I want the service to terminate, if an...
18
by: lgbjr | last post by:
Hi All, I have a VB.NET app that, among other things, writes data to Excel. I am having trouble getting the Excel process to terminate after I quit Excel. I found an article related to this...
4
by: S Shulman | last post by:
Hi I am using the Suspend method to terminate a thread but it seems that after calling that method the IsLive property is still set to True Is there another way to terminate a thread from the...
35
by: Aaron Gray | last post by:
Hi, I have some code I just cannot seem to get to work properly on FireFox. It is probably something simple. On FireFox the following code does not seem to terminate in the browser, but it...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.