开发者

Best way to re-create a dynamic table in css

开发者 https://www.devze.com 2023-04-07 12:43 出处:网络
Curious to see what method o开发者_如何学Cther people are using to re-create fluid tables in CSS.

Curious to see what method o开发者_如何学Cther people are using to re-create fluid tables in CSS.

Back in table days, if there wasn't a width set the table would just auto-adjust to make the columns fit.

Let's say: We have a 2column "table" display a product. Image on the left, Name/Description on the right.

Let's also say: Image width is unknown.

Typically in this situation, what I do is float the image left and hide the overflow on the content to the right. If we have rows of data though, this simply will not work as everything will have different margins.

Yes, We could just say: Images will not be bigger then x so let's float the image left and set a left margin on the right side content. - or even float the content on the right to the right.

Doing this really isn't a problem, however I am just curious as if there was a way to make it all fluid... Some of these sites I'm working on have enormous stylesheets and I'm trying to keep the styles to a minimum.

Our designer likes to use this image to the left, content to the right - or even reversed... image to the right content to the left A LOT, but it seems as the margins are always different per situation. I really want to make this a re-usable class.


http://jsfiddle.net/simoncereska/dGnzJ/ Take a look at this. If you add class .p-r to .img you'll get another view. Is this what you are asking for?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号