views:

1231

answers:

5

I'm implementing a comment control that uses an ASP.Repeater to display each comment. The comment itself is currently displayed using a table to divide up some images to display the comment in a bubble.

I know that tables are supposed to be the epitome of evil for design layout, and really expensive to display for the browser, but I'm not exactly sure how to put my rounded corners in the correct location and make sure everything lines up.

Does anyone have any suggestions, examples, hacks for the HTML/CSS required, or should I just stick with tables and hope for the best?

+1  A: 

There are a few different ways to do rounded corners in CSS

I prefer using CSS to tables whenever possible, just because I find the code to be a lot easier to maintain, and this sounds like a project with the perfect scope to get your feet wet.

Wayne
CSS tables is a bit of an oxymoron. Not in the literal sense of what it is, but in the logical sense. CSS design should only use tables for tabular data, not for content positioning.
lordscarlet
A: 

In short you would want something like this:

<style>
  .start { background-image: url("topofbubble.png"); height: <heightofimage>; }
  .end { background-image: url("bottomofbubble.png"); height: <heightofimage>; }
  .body {background-image: url("sliceofbubblemiddle.png"); }
</style>

...

<div class="comment">
  <span class="start"></span>
  <span class="body">I would like to say that div layouts are far better than table layouts.</span>
  <span class="end"></style>
</div>

That should get you started. I did not try the code specifically and can make a complete example if necessary.

lordscarlet
This is a good suggestion, but not quite what I need, since the widths are fluid, there needs to be a center line for each side that can be repeated
Andrew Burgess
Yeah, being supplied with a better example is always a good idea with these questions. :) It gets more complicated if it is fluid and you'll need more divs. This is one of the hardest things to do with CSS design, but is an edge case for the most part.
lordscarlet
A: 

I just rebuilt my site last weekend using divs for menus and layout. I don't have rounded corners, but you're welcome to rip anything off from source or css to get started.

If you have images for corners, you'll probably need to look into absolute layouts with fixed sizes.

Anyway, the site is hoolihan.net

+3  A: 

The best resource I've seen for creating rounded corners using DIV elements was an article on "A List Apart" - see http://alistapart.com/articles/customcorners/. If you're looking to use DIV elements to layout your entire site, there are several other relevant articles on that site. See:

http://alistapart.com/articles/slidingdoors/
http://www.alistapart.com/articles/slidingdoors2/
http://www.alistapart.com/articles/negativemargins/

Steve Moyer
A: 

If you are willing to present IE users with sharp corners, rounded corners are trivially solvable with the border-radius CSS property. No browser currently implements it as a base property, but several do as a prefixed property. For example, to use it in firefox, you would use the property "-moz-border-radius", for Safari, use "-webkit-border-radius", etc.

Xanthir