Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
How do i make a css photo gallery?
Old 10-24-2010, 08:54 PM How do i make a css photo gallery?
Novice Talker

Posts: 7
Name: Brandon
Trades: 0
Im looking to make a css photo gallery. Very simple that can fit on one page, and has no javascript or anything fancy. It's for a school project and all we have learned is CSS and HTML coding.
brandonwaugh is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-25-2010, 01:04 AM Re: How do i make a css photo gallery?
roshan@di91.com's Avatar
Experienced Talker

Posts: 30
Name: Roshan Chaudhary
Location: Haryana
Trades: 0
Creating a photo gallery in CSS without table:

I have received several emails recently about creating galleries with CSS. Most people still use tables to create your basic image gallery in CSS. There is a much simpler way to do this with a list and some very easy CSS. Depending on what you want to do with your photo gallery you may want to have a caption or more information available on the page. This simple method can be expanded for use on staff pages or real estate sites to list houses for sale.


The methodology is to put each image and subsequent text into an <li> and then manage the text inside just as you would any other HTML structure. The important part is getting the CSS to manipulate your list to the image gallery form.

The simple HTML to structure the photo gallery

<ul class="gallery">
<li><a href="/images/image.jpg"><img src="/images/image_tn.jpg" alt="image" /></a>
<br />Image Caption</li>
<li><a href="/images/image.jpg"><img src="/images/image_tn.jpg" alt="image" /></a>
<br />Image Caption</li>
<li><a href="/images/image.jpg"><img src="/images/image_tn.jpg" alt="image" /></a>
<br />Image Caption</li>
<li><a href="/images/image.jpg"><img src="/images/image_tn.jpg" alt="image" /></a>
<br />Image Caption</li>
<li><a href="/images/image.jpg"><img src="/images/image_tn.jpg" alt="image" /></a>
<br />Image Caption</li>
</ul>
The simple CSS to style the gallery’s HTML
.gallery li {
display: inline;
list-style: none;
width: 150px;
min-height: 175px;
float: left;
margin: 0 10px 10px 0;
text-align: center;
}
Now with all of the code working together

Image Caption
Image Caption
Image Caption
Image Caption
Image Caption


Other ways to style your image gallery without tables
You can also use a div to create your photo gallery instead of using a list. It works much in the same way that using a list does, some prefer this method over using a list. I will typically use a list because I feel it is more semantically correct than using a div. Anyone else use a different method to create a photo gallery than these two methods
roshan@di91.com is offline
Reply With Quote
View Public Profile Visit roshan@di91.com's homepage!
 
Old 10-25-2010, 05:32 AM Re: How do i make a css photo gallery?
edgray's Avatar
Super Moderator

Latest Blog Post:
Frantic
Posts: 4,264
Name: Sugarcane Gray
Location: Hell, Southern Spain
Trades: 0
I don't know if an unordered list is the best way to go for this.

I would do something like this:

HTML Code:
<div id="gallery">
  <div class="imagebox">
    image in here
  </div>
  <div class="imagebox">
    image in here
  </div>
  <div class="imagebox">
    image in here
  </div>
</div>
And apply a style like this:

Code:
#gallery { width: 600px; }
.imagebox { float: left; width: 180px; margin-right: 20px; }
have a play with that, remember to clear your floats.
__________________

Please login or register to view this content. Registration is FREE
- a project in video and sound.

Please login or register to view this content. Registration is FREE
"Absolute Rubbish, an insult to the blues." - NME.

Please login or register to view this content. Registration is FREE
- Come use our agency :)

Last edited by edgray; 10-25-2010 at 05:33 AM..
edgray is offline
Reply With Quote
View Public Profile Visit edgray's homepage!
 
Old 10-25-2010, 06:29 AM Re: How do i make a css photo gallery?
CSM
CSM's Avatar
Front-End Developer

Posts: 297
Name: Michael Pehl
Location: Palma de Mallorca
Trades: 0
Here is a CSS3 animated gallery

http://www.cssplay.co.uk/menu/css3-photo-slide.html

CSSplay has a lot of others, too... check it out
__________________
Chief Web Officer / Front-End Developer / System Engineer

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
CSM is offline
Reply With Quote
View Public Profile Visit CSM's homepage!
 
Old 10-25-2010, 10:11 AM Re: How do i make a css photo gallery?
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Why reinvent the wheel?? http://www.webmaster-talk.com/websit...galleries.html
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 10-25-2010, 08:48 PM Re: How do i make a css photo gallery?
Banned

Posts: 408
Name: mushget
Trades: 0
You can easily accomplish this by making each picture the background of whatever your gallery is going to be. For example, if there is a <div> for the frame of the gallery, then make a picture the background to that <div>. If you want a "Next" and "Back" option, then have the hyperlink take the user to a new page where that <div>'s background is a different picture.
mushget is offline
Reply With Quote
View Public Profile Visit mushget's homepage!
 
Old 10-27-2010, 02:22 AM Re: How do i make a css photo gallery?
Novice Talker

Posts: 7
Name: Brandon
Trades: 0
Thanks for the help !
brandonwaugh is offline
Reply With Quote
View Public Profile
 
Old 11-01-2010, 01:38 AM Re: How do i make a css photo gallery?
Html Web Design's Avatar
Experienced Talker

Posts: 31
Name: WP Themes
Location: Nagpur
Trades: 0
CSS code

Code:
<style type="text/css">
/* ********************************************* 
* This notice MUST stay intact for legal use.
* This script was created for FREE CSS Menus.
* Visit: www.freecssmenus.co.uk for more CSS. 
* Also visit our Free online menu creator.
************************************************ */ 
/* credits: www.freecssmenus.co.uk */
#pg { width:390px;
height:200px;
border:2px dotted #666;
padding:5px;
padding-top:15px;
}
#pg ul { list-style:none;
  padding:0;
  margin:0;
  width:180px;
  position:relative;
  float:left;
}
#pg ul li { display:inline;
  width:52px;
  height:52px;
  float:left;
  margin:0 0 8px 8px;
}
#pg ul li a { display:block;
  width:50px;
  height:50px;
  text-decoration:none;
  border:1px solid #000;
}
#pg ul li a img { display:block;
  width:50px;
  height:50px;
  border:0;
}
#pg ul li a:hover { white-space:normal;
  border-color:#336600;
background-color:#AABB33;
}
#pg ul li a:hover img { position:absolute;
  left:190px;
 top:0;
  width:auto;
  height:110px;
  border:1px solid #000;
}
#pg ul li a span {display:none}
#pg ul li a:hover span { display:block;
position:absolute;
  left:5px;
  top:130px;
  width:350px;
  height:auto;
font-size:12px;
color:#999999;
}

</style>
HTML code
Code:
<div id="pg">
  <ul>
  <li>
<a href="css_rollover_uk_map.php">
<img src="upimage/ukmap345.jpg" alt="Css Rollover Map" />
<span>
<strong>
CSS Map.</strong>
 CSS Image swap on rollover/hover. This simple display of CSS shows the  versatility of Cascading Style Sheets. Remember this animation is 100%  User Accessible.</span>
</a>
</li>
  <li>
<a href="big_css_button.php">
<img src="upimage/bigbutton1390.jpg" alt="Large Css Button" />
<span>
<strong>
CSS Big Button.</strong>
 Css buttons can be as large and as extravagant as you like. Using one  image you can create simple css buttons like this. This button is still a  hyperlink not just an image.</span>
</a>
</li>
  <li>
<a href="menu_opacity.php">
<img src="upimage/003opacity639.jpg" alt="Css Opacity" />
<span>
<strong>
CSS Opacity Menu.</strong>
  you can use styles to change the opacity of an image. This creates interesting effects when creating a menu. </span>
</a>
</li>
  <li>
<a href="#">
<img src="upimage/freemusic885.jpg" alt="Free Mp3 Downloads: Unborn Records" />
<span>
<strong>
Unborn Records </strong>
Download free mp3 music for your ipod or mp3 player. Download free music from unsigned artists</span>
</a>
</li>
  <li>
<a href="#">
<img src="upimage/trix363.jpg" alt="Visit Trix the dog at www.catandtwodogs.co.u" />
<span>
<strong>
Cat And Two Dogs </strong>
 Visit my three pets at www.catandtwodogs.co.uk . This is a picture of trix, he's a border collie.</span>
</a>
</li>
  <li>
<a href="#">
<img src="upimage/colours238.jpg" alt="A picture of colours in a swirl" />
<span>
<strong>
A swirl of colours. </strong>
 This is just a picture of colours in a swirl effect.</span>
</a>
</li>
  </ul>
</div>
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Last edited by Html Web Design; 11-01-2010 at 01:40 AM..
Html Web Design is offline
Reply With Quote
View Public Profile Visit Html Web Design's homepage!
 
Reply     « Reply to How do i make a css photo gallery?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.48360 seconds with 12 queries