Help with div borders in FF, please?

This is a discussion on "Help with div borders in FF, please?" within the Web Page Design section. This forum, and the thread "Help with div borders in FF, please? are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Apr 10th, 2007, 06:07
Reputable Member
Join Date: Mar 2005
Location: Margaritaville (a state of mind somewhere between Inebriation and San Diego), CA
Posts: 245
Thanks: 6
Thanked 0 Times in 0 Posts
Help with div borders in FF, please?

I'm beginning to convert tables to multiple DIVs within a container div. It's going OK, except that when I put a border on the container div, IE renders it as expected, while Firefox does not. Can anyone tell me why? And how to fix it?

Here's a link to a page that demonstrates what I'm talking about: http://stickpuppy.com/tbl2div.php

In IE, I get a gray background and a 2px blue border. In FF, not only does the container div (and its gray background and blue border) not wrap around the divs it contains, but the following paragraph isn't even displayed in block mode!

Also, if I'm going about this all wrong in general, please let me know. I've read and read and read about CSS-P but I just can't seem to wrap my brain around it.

With all the CSS code I'm writing for cell divs, row divs and container divs, I'm really starting to wonder why I'm bothering. Table code is not only easier, it seems to me it's more efficient, too.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Apr 10th, 2007, 12:42
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help with div borders in FF, please?

If this

Code: Select all
<div id="t2d_table">
            <div class="row">
                <div class="cell1">R1C1</div>
                <div class="cell1">R1C2</div>
                <div class="cell1">R1C3</div>
                <div class="cell1">R1C4</div>
            </div>
            <div class="row">
                <div class="cell2">R2C1</div>
                <div class="cell2">R2C2</div>
                <div class="cell2">R2C3</div>
            </div>
            <div class="row">
                <div class="cell1">R3C1</div>
                <div class="cell1">R3C2</div>
                <div class="cell1">R3C3</div>
                <div class="cell1">R3C4</div>
            </div>
        </div>
is going to be filled with data ... then use the TABLE element!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Apr 10th, 2007, 12:58
masonbarge's Avatar
Highly Reputable Member
Join Date: Jan 2006
Location: Atlanta GA
Posts: 631
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help with div borders in FF, please?

Code: Select all
<div id="t2d_table"> <div class="row">
    <div class="cell1">R1C1</div>
    <div class="cell1">R1C2</div>
    <div class="cell1">R1C3</div>
    <div class="cell1">R1C4</div>
</div>
<div class="row">
<div class="cell2">R2C1</div>
<div class="cell2">R2C2</div>
<div class="cell2">R2C3</div>
</div>
</div>
Try this.
in your css:
Code: Select all
.clear { clear: both; }
Then:
Code: Select all
<div id="t2d_table"> <div class="row">
    <div class="cell1">R1C1</div>
    <div class="cell1">R1C2</div>
    <div class="cell1">R1C3</div>
    <div class="cell1">R1C4</div>
</div>
<div class="row">
<div class="cell2">R2C1</div>
<div class="cell2">R2C2</div>
<div class="cell2">R2C3</div>
</div>
<div class="clear"></div>
</div>
If this isn't right, move the clearing div around a bit.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Apr 10th, 2007, 13:44
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help with div borders in FF, please?

I agree with Karinne. Tables are for tabular data, not layouts. Your mess of <div>'s should indeed be a table.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Apr 10th, 2007, 16:07
Reputable Member
Join Date: Mar 2005
Location: Margaritaville (a state of mind somewhere between Inebriation and San Diego), CA
Posts: 245
Thanks: 6
Thanked 0 Times in 0 Posts
Re: Help with div borders in FF, please?

Quote:
Originally Posted by karinne View Post
If this
is going to be filled with data ... then use the TABLE element!
It's not. I just did that as a sample. It's going to be filled with elements of a form - and using table markup, it's a piece of cake, but trying to switch to divs (again, I'm asking myself, "WHY?!?!") is making me crazy. :crazy:

I have no problem using absolutely positioned DIVs (as seen here: http://dhs57.com ) nor in using 2 or 3 column layouts, but I wish I could find a good tutorial on stacking divs into rows and stacking rows of divs into tables. (Either that or a really good argument on why not to bother doing so, but rather to just stick with tables! :annoyed: )
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Apr 10th, 2007, 16:12
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help with div borders in FF, please?

Use tables if you want for forms ... or <dt> and <dd> I've seen that used a few times too.

http://www.themaninblue.com/experiment/InForm/index.htm

Last edited by karinne; Apr 10th, 2007 at 16:15.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Apr 10th, 2007, 16:24
Most Reputable Member
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help with div borders in FF, please?

I personally think that is a ridiculous use of defintion lists. I know the html spec is pretty vague on the use of definition lists but that's pushing it a bit for me. It makes no sense. People seem to use defintion lists for whatever they want which simply strips them of meaning. I've seen dl's used in e-stores to list the products - it's a list sure but why not use ul's.

I'd just use the form tag on it's own and then style it in the css, I don't see why you want to put it in seperate divs at all. Could you elaborate a bit please on exactly what you want to do with the form elements.

Pete.

Last edited by pa007; Apr 10th, 2007 at 16:25. Reason: spelling
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Apr 10th, 2007, 17:41
Reputable Member
Join Date: Mar 2005
Location: Margaritaville (a state of mind somewhere between Inebriation and San Diego), CA
Posts: 245
Thanks: 6
Thanked 0 Times in 0 Posts
Re: Help with div borders in FF, please?

Quote:
Originally Posted by masonbarge View Post
Try this.
in your css:
Code: Select all
.clear { clear: both; }
Then:
Code: Select all
<div id="t2d_table"> <div class="row">
    <div class="cell1">R1C1</div>
    <div class="cell1">R1C2</div>
    <div class="cell1">R1C3</div>
    <div class="cell1">R1C4</div>
</div>
<div class="row">
<div class="cell2">R2C1</div>
<div class="cell2">R2C2</div>
<div class="cell2">R2C3</div>
</div>
<div class="clear"></div>
</div>
Worked beautifully. Thanks, Mason!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Apr 10th, 2007, 18:04
Reputable Member
Join Date: Mar 2005
Location: Margaritaville (a state of mind somewhere between Inebriation and San Diego), CA
Posts: 245
Thanks: 6
Thanked 0 Times in 0 Posts
Re: Help with div borders in FF, please?

Quote:
Originally Posted by pa007 View Post
I'd just use the form tag on it's own and then style it in the css, I don't see why you want to put it in seperate divs at all.
Maybe I'm looking at this all wrong, but how would you position the individual elements (assuming you didn't want a basic columnar layout)?
Quote:
Could you elaborate a bit please on exactly what you want to do with the form elements.
Happy to. Thanks for asking.

The form is part of a basic message board. (See attachments for clarification) It's for a group of seniors, the majority of whom are very non-tech-savvy. If they are logged in, the "post message" form is shown at the top of the page. By default, the form only has 3 elements and a submit button. (5 elements if you count the 2 labels.) But if they want to use smilies or (bold or italic) text formatting, there's a "hints" box that shows them how to do that. A link at the top toggles whether the hints are visible (they are hidden by default), so right off the bat, that needed a container div so I could toggle the display property.

For what it's worth, thanks to Mason's suggestion, the whole thing now works. The screenshots you see are post-revision and use divs rather than table markup (but it was painful!)
Attached Images
File Type: jpg form-nohints.jpg (45.7 KB, 19 views)
File Type: jpg form-hints.jpg (104.2 KB, 31 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Apr 10th, 2007, 18:20
Most Reputable Member
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help with div borders in FF, please?

There are a few ways you could go about styling forms. I will give an example. If I were doing a simple contact form which when submitted would send an email with the contents in. By the way this form wouldn't actually work (just for the record).

Here is the html:

Code: Select all
<form id="contact-form">
<p> 
<label for="name">Name:</label><br />
<input type="text" name="name" id="name" /><br />
<label for="email">E-mail</label><br />
<input type="text" name="email" id="email" /><br />
<label for="message">Message:</label><br />
<textarea name="message"></textarea><br />
<input type="submit" value="Send Message" name="submite" id="submit" />
</p>
</form>
Using the id's you can pinpoint which elements you want to format.

Here is the CSS:

Code: Select all
form#contact-form input#name, form#contact-form input#email, form#contact-form textarea {
    width: 400px;
    padding: 0.2em;
    border: 1px solid #a2b8ce;
    margin: 0 0 10px 0;
}

form#contact-form textarea {
    height: 150px;
}

form#contact-form input#submit {
    width: 10em;
    
}
No need for extra divs or anything, strictly speaking you don'e even need all of the ids. But that is a simple way to style forms and only results in a little extra markup.

You can make use of lots of css trickery to style forms and you only need a little bit of extra markup.

Pete.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Apr 10th, 2007, 18:22
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help with div borders in FF, please?

You can also have a look in the Beginners Resources section, there's a thread - [CSS] Customize your form with CSS - that could help you out on this as well.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old Apr 10th, 2007, 20:05
Reputable Member
Join Date: Mar 2005
Location: Margaritaville (a state of mind somewhere between Inebriation and San Diego), CA
Posts: 245
Thanks: 6
Thanked 0 Times in 0 Posts
Re: Help with div borders in FF, please?

Wow! I replaced all those divs with <label> tags and used <button> to use an image for my submit button (instead of a borderless, transparent button over a background speech bubble image) and I'm shocked at how well it came out (and how much less code!)

I've always avoided those tags, though, due to uncertainty over support in older and non-mainstream browsers... can anyone comment on that?

Thanks, Pete and Karinne!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13  
Old Apr 10th, 2007, 20:09
Most Reputable Member
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help with div borders in FF, please?

The label tags are great for accessibility too, so I'd say use them all the time. Rather than the button element, I'd use the input type="submit" and set a background image for it. But you should try to avoid styling forms too heavily as they need to be recognisable to the user.

Pete.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
borders, div, firefox, table

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Div borders & different browsers djeyewater Web Page Design 0 Jan 6th, 2008 23:17
Translucent Borders? jjpeacha Web Page Design 10 Apr 29th, 2007 20:27
Tables and 1px borders? Perad Web Page Design 3 Dec 9th, 2006 19:34
borders benbacardi Web Page Design 2 Jun 4th, 2004 15:39


All times are GMT. The time now is 09:37.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42