This is a discussion on "Problems making the content area have a dynamic height" within the Web Page Design section. This forum, and the thread "Problems making the content area have a dynamic height are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
Problems making the content area have a dynamic height
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Problems making the content area have a dynamic height
Hi guys,
I'm currently trying to turn this into XHTML/CSS: ![]() The problem is that it needs to have a dynamic height, so I've no idea how to approach the problem. The first step I'd say would be to create an image along the entire top that's about 5px high for the top of the box, and then a 1px high image for a repeating background. The problem I've got now is with the bottom area, and how to get text over it without having to create an entirely separate div and put the content between the two (which would be pretty awful). Thanks in advance for any advice, I'm really stuck on this! |
|
|
|
|||
|
Re: Problems making the content area have a dynamic height
Hey mate do you want the XHTML/CSS version to look exactly like the image above?
wayne |
|
|||
|
Re: Problems making the content area have a dynamic height
@ RXZ - Pretty much yup, but I'd like it so that the height will adjust according to how much content is in there.
@ karinne - thanks for the reply, my main problem though is the difference between the content and the bottom image. I mean, the gradient in the content area means I can't put it into actual middle div, yet if it's on the bottom one there'll be a large gap. Apologies if I've explained it badly, I usually do |
|
|||
|
Re: Problems making the content area have a dynamic height
The layout could be created in tables but like I keep getting told tables are not the best way of doing it but it would work but the gradient would have to be a set height due to getting it as a td background
Wayne |
|
||||
|
Re: Problems making the content area have a dynamic height
Bah ... I didn't notice the gradient! Sorry! Ugh! I hate dealing with gradients and outer-glows .... It's not the most Web-page-friendly design.
You have to remember that what looks great in PS might not be suitable for web ... only print |
|
|||
|
Re: Problems making the content area have a dynamic height
Ahh I see, thank you karinne, I might need to have a rethink of how I'm doing it then!
@ RZX - cheers dude, I'll consider using tables but I think I'd rather not if possible. Thanks again for the info though! |
|
|||
|
Re: Problems making the content area have a dynamic height
There are lots of variations, depending on how flexible you want your boxes to be, and how many effects.
I might write a tutorial on this, once I've got it working myself... For now, check out this tutorial, which is the basis for my (completely flexible) method. |
|
||||
|
Re: Problems making the content area have a dynamic height
Right ... but then ... how would you handle the outer glow on the borders AND the gradient?
|
|
|||
|
Re: Problems making the content area have a dynamic height
That's a sweet site thank you, but like karinne said, doing the outer glow is one thing but doing the gradient is going to be a nightmare.
I think I'll just ditch the outerglow thing and have a solid 1px border and then an image background for the gradient. Or something. |
|
|||
|
Re: Problems making the content area have a dynamic height
Quote:
With enough <div>s, you can do anything. |
|
||||
|
Re: Problems making the content area have a dynamic height
hmmm yeah but the display: table-cell isn't widely supported
|
|
|||
|
Re: Problems making the content area have a dynamic height
Well, not widely supported by IE.
But sometimes, depending on what you're doing, you can hack it with javascript for IE. For this effect, however, I think display: table-cell is unnecessary. |
|
||||
|
Re: Problems making the content area have a dynamic height
Well ... I can't wait to see this
|
|
|||
|
Re: Problems making the content area have a dynamic height
Actually, it was a lot easier than I thought. Here's a screenshot:
![]() This is fully scalable (the box width is defined in ems), and won't break no matter how big the box (unlike "sliding doors" techniques). It uses nine images with a total file size of less than 2 Kb (with lossless compression). The only limitation is that it only works on flat backgrounds. The images must not use transparency. If your page background is patterned, then this will break (at least slightly). If you want, you can even add another gradient for the box heading. How it works In this example, I'm using a <dl> (but you don't have to). Here's my HTML code:
I use javascript to add seven nested <div>s inside the <dl>, transforming the code into this:
The order is important: the corners must be applied to the deeper four <div>s, because these will stack on top of the sides. You must also be careful to match the images so that the corners line up with the sides. This is easy if you are methodical about creating your source graphic. The content will stretch the <dl> and <div>s that surround it. To make the effect visible, I add padding in the deepest <div>. The padding matches the size of each side image (not the corners, which are larger). The gradient itself is just applied to the <dd> CSS background. That's it. Simple, huh? Last edited by MikeHopley; Aug 2nd, 2007 at 23:01. |
|
|||
|
Re: Problems making the content area have a dynamic height
Actually, I might stop using the javascript to generate the extra markup, because it sometimes fails (page refresh cures it).
Either that, or I'll make it run again after a delay and check. Last edited by MikeHopley; Aug 2nd, 2007 at 23:22. |
|
||||
|
Re: Problems making the content area have a dynamic height
Hmmm ...yeah but the gradient is only at the very bottom as oppose to the OP's gradient starts from the very top and extends all the way down
|
|
|||
|
Re: Problems making the content area have a dynamic height
Quote:
If you want me to make the gradient stretch with the height, I'm afraid that's asking too much. But you can just use a larger gradient. I don't think a stretchy gradient would look nice, anyway. ![]() Before you complain about the orange title: it would just require one extra <div> to apply the gradient across the whole box. Last edited by MikeHopley; Aug 3rd, 2007 at 09:07. |
|
|||
|
Re: Problems making the content area have a dynamic height
Note that the gradient can be:
If the box is smaller than the gradient image, then some of the gradient will be cut off (at top or bottom). If the box is larger, then some of the box will be shaded with (matching) flat colour. Last edited by MikeHopley; Aug 3rd, 2007 at 09:17. |
![]() |
| Tags |
| css, xhtml |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to constrain the height of a dynamic table | MrQuestions | Web Page Design | 3 | Mar 15th, 2008 00:08 |
| CSS - dynamic height div | Web Page Design | 39 | Dec 4th, 2007 15:33 | |
| Making a text area | martyoo | Web Page Design | 4 | Aug 29th, 2007 20:19 |
| content area not expanding | Lchad | Web Page Design | 19 | Jan 29th, 2007 14:45 |
| Making sure the height of both divs is = | csa | Web Page Design | 8 | May 3rd, 2006 18:22 |