We want to have two divs side by side.
In the left DIV are a line up of divs containing products.
In the right div (float:left) we have a Buy Now button.
But sometimes the left div won't contain enough products to fill the screen, so there is a big gap between the left and right divs.
Can the left one just be given a CAP of a percentage. So that it only goes up to 85%, and the right one is fixed at 15%, but if there are only 3 products in the left DIV, the container will only go so far. A bit like using a TABLE and not giving it a width - it stretches to fit.
Can you set a DIV to max width, so it stretches up to that?
Moderator: General Moderators
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Can you set a DIV to max width, so it stretches up to that?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Can you set a DIV to max width, so it stretches up to th
Do you mean something like this? https://codepen.io/anon/pen/vmdpdV
Play with the number of child divs on the left to see what I mean.
Play with the number of child divs on the left to see what I mean.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Can you set a DIV to max width, so it stretches up to th
No. The way you have done it there, there three DIVs on the left, would stretch. So if images were in there, they would all be stretch as at 100% each.
I want the inner divs to be set to 6 across, but not to stretch to fill that left column.
So let's say I have a Bundle with 3 products, and a Bundle with 10 products.
The left column contains the tiled DIVs. the right column has the Buy Now button.
If the first Bundle (3) is not wide enough to fill the screen, then that outer div should not be stretched out as there isn't enough inside it's DIV to push it out.
But Bundle (10) does, in fact it's inner DIVs would tiled to a second row, but the Buy Now div would still be at the top over on the far right, as it's products are pushing it out to the max width of 85%.
Make sense?
I want the inner divs to be set to 6 across, but not to stretch to fill that left column.
So let's say I have a Bundle with 3 products, and a Bundle with 10 products.
The left column contains the tiled DIVs. the right column has the Buy Now button.
If the first Bundle (3) is not wide enough to fill the screen, then that outer div should not be stretched out as there isn't enough inside it's DIV to push it out.
But Bundle (10) does, in fact it's inner DIVs would tiled to a second row, but the Buy Now div would still be at the top over on the far right, as it's products are pushing it out to the max width of 85%.
Make sense?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Can you set a DIV to max width, so it stretches up to th
Having a fresh think about this. It wouldnt' work. If the DIVs containing the product photos are set to 14%, with the image set to 100%, it will be 14%/100% of the parent DIV - the one I want to be smaller or larger, depending on the amount in it's DIV.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.