473,387 Members | 1,579 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,387 software developers and data experts.

CSS: <div>s with borders don't surround sub-<div>s?

I was using a <table border> to generate borders around some
info/images, and decided to follow the w3c guidelines and convert it
to CSS boxes with borders since it wasn't really tabular data.

It used to be something like this:

<table>
<tr>
<td><img>caption</td>
<td><img>caption</td>
</tr>
<tr>
<td><img>caption</td>
<td><img>caption</td>
</tr>
</table>

Basically, I want to change it to be "border-style:outset" for the
<table> tags, and "border-style:inset" for the <td> tags, and have
them flow around each other. The only way it seems that I can get the
boxes to surrond both the text and the images with at <div> tag, but
then it inserts a line break after each one. If I use "float:left" it
doesn't line break, but if I float all of the <div>'s, the resulting
"outset" box is zero pixels tall. If I float all but the last <div>
image, it gives me a really weird effect where the last box is too
tall. (i.e. the height of the whole box, not just of the image....

Any suggestions?

Here's the original:

http://nelson.oit.unc.edu/~alanh/mypics.html

Here is one attempt at just doing the top table:

http://nelson.oit.unc.edu/~alanh/mypics.css.html

As you can see, it doesn't really work. I've tried this with multiple
browsers....

For another example, view the following site with a Mozilla
derivitive:

http://nelson.oit.unc.edu/~alanh/

-alan

--
Alan Hoyle - al***@unc.edu - http://www.alanhoyle.com/
"I don't want the world, I just want your half." -TMBG
Get Horizontal, Play Ultimate.
Jul 20 '05 #1
1 3887
Alan Hoyle wrote:

[snip]
Basically, I want to change it to be "border-style:outset" for the
<table> tags, and "border-style:inset" for the <td> tags, and have
them flow around each other. The only way it seems that I can get the
boxes to surrond both the text and the images with at <div> tag, but
then it inserts a line break after each one. If I use "float:left" it
doesn't line break, but if I float all of the <div>'s, the resulting
"outset" box is zero pixels tall.

[snip]

It sounds like you might want to use one of the list element types, not a
set of <div> elements. In any case, you can get around the problem of
floating elements not affecting the height of the parent quite easily. Put
an element after all the floating elements that is invisible, yet uses the
clear property to be placed after the floating elements. This element will
then affect the height of the parent element.
--
Jim Dabell

Jul 20 '05 #2

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

Similar topics

7
by: Eduard Dewolf | last post by:
Hi, Im have been changing my site to make it HTML 4.01 compliant As I should, I wrapped all INPUT tags in blocks I wrapped the not visible INPUT type HIDDEN tags in first PRE, later H6 tags...
8
by: Nairb | last post by:
I like some css anchor to button stuff posted by someone a while back, but want the buttons to be the same width. How can I get the anchor for 'test' and 'longerTest' to be the same width when...
6
by: Patrick | last post by:
Hi I am a newbie struggling a little with css.It is hard to get it right in all browsers, so i decided to read the CSS2 specification on the w3 site. What is the following from the CSS2...
1
by: Silky | last post by:
Iam trying to get the green footer div to sit on the bottom of all three divs so as the divs vary in height it sits off the bottom of the lowest one I cannot use absolutes because the three...
2
by: Joop Vos | last post by:
Hi, On the html-page there is an image at the top with a small white line underneath ... as a border ... only in IE/win there is a small gap!? html >...
4
by: gomesbascoy | last post by:
I'm trying to do that, like a 3x3 table (with specific width and height) BUT whit divs and without absolute position.... this is my imposible mission xD example:
2
by: benjaminmartin | last post by:
hey all, After many many many hours of trying to get this to work i am at my wits end. Have had a few people try to help but nothing seems to solve the problem. Basically the site works...
2
by: AR123 | last post by:
I want to convert my website tables layout to div tags as someone told me its easier to make changes etc etc I just need some help in getting started with this and what to put in the stylesheet. the...
14
by: greentiger1 | last post by:
I'm moderately experienced in CSS. I am currently working on a new version of my site, built from the ground up, but the dynamic portion, loaded with a PHP include into the 'chest' DIV is being...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.