Gallery view of products in html - css

I have the following content as the first content
#content {
border-radius: 5px;
background:#FFFFFF;
text-align:left;
padding:20px 20px 5px;
margin:15px 0 15px 0;
}
inside them I have two divs that both float to left as below:
<div id="content">
<div class="my_left_menu">
//this floats left
</div>
<div class="my_right_content">
//this also floats left
</div>
</div>
Now in the right content I want to have a gallery of products like shown in on line shopping website. So I created another div class that floats left and placed all the images inside it, but every image is coming vertically. But I want it to be something gallery view or grid like view. How can I do it ? any idea please?

If I understood you right you want to show a grid-like list of products on your right side div that is div.my_right_content but they are shown vertically.
Basically what you need to do is to tell the inner div tags which are your products not to take all the width available. A simple way is to give them a fixed width and if the browser is resized or your page is being displayed on a smaller screen then they can align vertically to have enough space for your content. Here is what you can do:
<div id="content">
<div class="left-col">
</div>
<div class="right-col">
<div class="product">
... your product info and content
</div>
<div class="product">
... your product info and content
</div>
</div>
</div>
And then give them a style rule like this
.product {
width: 100%;
max-width: 200px;
display: inline-block;
}
So they will align horizontally and when the browser width is not enough to hold two 200px wide products horizontally they will be aligned vertically. This also means that if your .right-col container is 600px in width it will hold three products in each line.
If you want it to be more perfectly aligned you may want to give each product a fixed height too.
Regards,
Shakib

Related

css blueprint, create a div floating next to container div ? image attached

Im trying to have a blueprint layout wich is 950px so I do something like the image below:
Like regular the 950px container ( right box ) is floating center page
Now I'm in the need of having a #menu div floating left towards this 950px box, it should be positioned left to this #container 950px div and have a fixed width.
How can such a thing be accomplished? I tried already several css tricks to no avail, i know there is liquid layout but then the space between #menu and #container will become to big I want that space to be fixed like in below example say 20px the blueprint default.
anyone knows how to make this happen and have the divs stay on page even when screen resizes?
if i understood your question this will do what you want:
body, html
{
width: 100%;
}
<div style="margin: 0 auto; width: 1100px">
<div style="width: 150px; float:left;">
menu
</div>
<div style="width: 950px; float:left;">
right part
</div>
</div>

How to expand a fluid element out past a fixed width template

I've got myself into a bit of predicament where I have a fixed width site, but need two fluid width bars to go 100% across the screen. I'm using a rather horrible wordpress template for the site in question, that every time you save any settings it saves the content width as per its settings. In this case it's 900px.
Thing is I'm happy with the whole site being 900px, it's just a header bar and footer bar that I need 100%, even the elements inside these bars can be 900px, I just need the colour to extend to each side of the screen.
The site in question is http://mysterybox.co/ You can see from the image below which bar I need extended out. If anyone could point me in the right direction that would be great.
Just create a new container for both your header and footer and take them out of your #container div. Something like this will work:
HTML
<div class="header-wrapper">
<div id="headerwidth">
....
</div>
</div>
<div class="footer-wrapper">
<div id="footer">
....
</div>
</div>
CSS
.header-wrapper, .footer-wrapper {
background-color:#000;
margin:30px 0 40px;
}
#headerwidth, #footer {
width:900px;
margin:0 auto;
}

SimpleModal - scroll floated div

I am using jQuery SimpleModal in order to display product information. For this I have two divs which are to be shown in one modal dialog: The left div holds the product logo and some description right underneath the logo. The right div holds detailled information about the product. The content in the right div can become quite long.
What I need the modal dialog to do is to keep the left div at its position while the right div scrolls if its content is too long. How can this be accomplished?
Here is my HTML structure within the modal dialog:
<div id="container">
<div id="leftColumn">
<div id="picture">
</div>
<div id="information">
</div>
</div>
<div id="rightColumn">
<p>Looooong text...</p>
</div>
</div>
Here the according CSS:
#leftColumn {
float: left;
}
#rightColumn {
overflow:auto;
}
if you use positioning in these divs it will be greatly helpful
setting up max-width:as you require; max-height:auto; can help you

CSS: Aligning to images below a flexible height content div

I have a site that has a fairly complicated footer, see http://www.roadsafetyforchildren.co.uk/, not really sure how to attempt to build it:
I've split the image up into two parts, the first part below needs to be horizontally centered but sit below the content:
The second part needs to repeat horizontally but stay in line with the image above.
Therefore the two images needs to look like the first image at the top of the question.
I can match the two images up IF the content div above it has a fixed height. The problem is the content div NEEDS to be flexible to grow/shrink with the content. Therefore the image at the bottom of the content div moves up and down the page depending on the size of it.
How can I keep the two images lined up with a flexible content div above it?
P.s There's a lot of answers but don't think a few of them have understood the question.
Seems straight forward to me, you will need two divs:
<div id="content">
<div id="inner_content">
<!-- Append image to very bottom -->
<img src="city" width="" height="" alt="" />
</div>
<!-- Background image of hills goes here -->
</div>
CSS is straight forward..
#content { width: 100%; background: url('hills.png') repeat center bottom; }
#inner_content { width: xx; margin: auto; }
try this:
html, body { margin:0; padding:0; min-height:100%;}
html { background: #color url(repeteable.jpg) center bottom repeat-x; }
body { background: white url(footer.jpg) center bottom no-repeat;}
Whatever <div> the content is in should be height:auto and have a background image of five or so pixels high by whatever width and should repeat-y in the css, and the <div class="footer"> should be float:left. That way the footer will always be below the content, and whatever height the content is will have a repeating background.
No need to mess with PS, except to create the bg image for the content.
This would be the bg image for content div, and repeat-y so it repeats from the top down:
And the footer image:
And if you make the 'background repeat' image a png, you could make the drop shadow opaque to accommodate the change in the body bg image.
You can position a background inside an element:
div#footer {
background: url('roadpic.jpg') bottom center no-repeat;
}
<div id="content">your content goes here</div>
<div id="footer">...</div>
which will keep the footer div below the content at all times.
You will need a common anchor point for both the backgrounds. Between a horizontally-resizable window and a content area that is less than 100% of the window width, the only point that can remain constant between the two containers is the horizontal centre of the body.
So your hills background will need to be centred on the body or some other container that has 100% of window width. The road image can either be fixed-position inside a fixed-width centred container (shown in the example below), or centred inside a centred variable-width container.
The resulting CSS will be something like this:
div#wrapper {
width: 100%;
background: url(hills.jpg) center bottom repeat-x #fff;
}
div#content {
width: 800px;
margin: 0 auto;
/* background can be offset to the left or right if the width is fixed
if not it must be centred */
background: url(road.png) right bottom no-repeat;
}
And the HTML:
<body>
<div id="wrapper">
<div id="content">
<p>Some content here</p>
</div> <!-- content -->
</div> <!-- wrapper -->
</body>
The backgrounds of both the containers will have same anchor point and they'll move together as the window is resized!
Because #content is a child of #wrapper, they'll remain aligned vertically because #wrapper will get taller as #content gets taller (unless #content is a float, in which case you'll have to use the :after clearing trick; or if #content is position:absolute, you'll need to align them manually or with javascript).

bottom align div next to floated divs

I am trying to get the following effect using css. I am trying to get bottom edges of title and 'right text' to align with logo's bottom edge, and get the title to stretch
vertically. I have included html and css
____________________________________________________________________________________________
|________________________________________________________TOP_TEXT_________________
| |
LOGO | title | right text
|____________________________________________________________________|
__________|______Menu__________________________________________________________|____________
<div id="wrapper">
<div id="logo"><img src="some.gif" width="193" height="77" /> </div>
<div id="top_text">top text</div>
<div id="right_text"> right text </div>
<div id="middle">
<div id="title">title</div>
<div id="menu">menu</div>
</div> <!-- middle -->
</div> <!-- wrapper -->
#wrapper {
width: 100%;
}
#logo {
float: left;
border-right:#FFFFFF thin solid;
}
#top_text {
text-align: right;
width: auto;
}
#right_text {
float: right;
border-left:#FFFFFF thin solid;
}
#middle{
/* may be needs some sort of height */
}
#title {
/* not sure how to put here */
}
#menu {
/* doesn't line up with bottom edge of logo and 'right' */
vertical-align:bottom;
}
In your case I guess vertical align would not be helping you. Rather you need to align your HTML more semantically so that you could use Position:relative,top and left or Margin-top/Margin right handy to align it.
Following Pseudo code Steps might be useful for you to align it.
Step 1: Try Defining logo in a container or float it alone left
Step 2: Trying defining a section comprising of three different
sections top text,title and menu and float the outer parent section as
well left.
Step 3: Try defining a right section and float it right
Step4: Position all the elements using Position:relative,top and left
or Margin-top/Margin right
The above steps would be helping you to get a picture perfect layout rather fiddling around with Vertical-align.
If you need further help on vertical-align here
http://www.w3schools.com/cssref/pr_pos_vertical-align.asp
Hope this answer helps.
Good luck.. happy coding.

Resources