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
Old 05-08-2010, 11:53 PM Alignment Problem
NickH's Avatar
Extreme Talker

Posts: 155
Trades: 0
Howdy, for fun/practice im making a mock up free lance site and for the portfolio section im having a bit of trouble with aligning the photos

at the moment it looks like this



where the list is going vertical and not really where i want it to be

the plan is to have it going three across and staying within the border

is this a css problem? and is there a way to fix it. I've been looking at a lot of websites but i cant really find a fix to the problem - im basing this design off of http://www.w3schools.com/css/css_image_gallery.asp
and if you need me to post code please say so
NickH is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-09-2010, 06:18 AM Re: Alignment Problem
monkey's Avatar
Ultra Talker

Posts: 487
Trades: 0
Essentially to build a css type gallery you need to first figure out how wide that div container is. Then you need to figure out what you consider to be reasonable space in between each photo. In your css you will then assign padding to the photos that are within that div container. If you want a spacing of 10 pixels between the photos then assign a padding of 5 to the images. You can then figure out the maximum width for each photo that would still allow you to fit 3 images in a row within the container.

I hope that makes sense. If you have more questions just ask.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
monkey is offline
Reply With Quote
View Public Profile Visit monkey's homepage!
 
Old 05-09-2010, 03:05 PM Re: Alignment Problem
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Float the list items, which will float the images with it.
CLEAR the floats (see our stickies) in the list so that they are contained within the div they're in.
__________________
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 05-09-2010, 11:44 PM Re: Alignment Problem
monkey's Avatar
Ultra Talker

Posts: 487
Trades: 0
Quote:
Originally Posted by LadynRed View Post
Float the list items, which will float the images with it.
CLEAR the floats (see our stickies) in the list so that they are contained within the div they're in.
Doh! I totally forgot to mention the floats. Mmmmm mmmm root beer.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
monkey is offline
Reply With Quote
View Public Profile Visit monkey's homepage!
 
Old 05-10-2010, 06:09 AM Re: Alignment Problem
NickH's Avatar
Extreme Talker

Posts: 155
Trades: 0
thanks for your help so far guys but im still having some issues - i tried the padding but it didnt work how i wanted it to

is there any positioning code i could use?
i plan to keep the page static without anything going outside of the screen therefore no scrolling

currently my code looks like

Code:
 /*image gallery for portfolio*/
            
            div.portfoliogallery     { 
                                    height:auto; width:auto; 
                                    float:left; text-align:center; 
                                    margin-top:75px; margin-left:50px; 
                                    }
                        
                        div.portfoliogallery img     {
                                                    display: inline; margin: 2px; 
                                                    border: 1px solid #ffffff;
                                                    }
                        
                        div.portfoliogallery a:hover img {border: 1px solid gray;}
                        
                        div.desc {text-align:center; font-weight:normal; width:120px; margin-left:25px; margin-left:75px;}
NickH is offline
Reply With Quote
View Public Profile
 
Old 05-10-2010, 03:23 PM Re: Alignment Problem
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
We really need to see either a URL or all your code.
__________________
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 05-14-2010, 06:07 AM Re: Alignment Problem
NickH's Avatar
Extreme Talker

Posts: 155
Trades: 0
alright then, i dont have a url yet because im going to get the site working then chuck it online

so heres the style sheet

Code:



body    {background-color:black; margin-right:250px;}
            
            p {font-family:arial, Sans Serif;}
            
            /*nav bar on top of all pages*/
            ul.navbar {border-style:solid; border-width:100%; color:#B3A062; border-color:#9933FF;
                        padding:5px; text-align:center; word-spacing:15px; 
                        font-family:Arial, Georgia, Sans-serif; font-size:x-large; 
                        background-color:black; -moz-border-radius:12px; -webkit-border-radius:12px; border:hidden; margin-top:10px; 
                        margin-left:350px; margin-right:150px;}
                        li.navbar {display:inline; font-family:arial, Sans Serif;}
            
            /*body of text on all pages*/            
            div.body {background-color:black; height:400px; width:100%; color:#B3A062; 
                    text-align:center;
                    padding-top:5px; padding-right:5px; padding-left:5px; 
                    font-family:arial, Sans Serif; word-spacing:10px; 
                    padding-bottom:0px; border-style:double; border-width:5px; border-color:gray;
                    -moz-border-radius:12px; -webkit-border-radius:12px; margin-top:-250px; margin-left:220px; width:800px;}
            
            /*bottom nav bar on all site pages except homepage NOT LINK TO APTANA/LEGAL INFO*/
            ul.bottomnavbar {color:#b5b5b5; text-align:center; font-size:12px; margin-bottom:3px; margin-top:0px; list-style-type:none; margin-left:230px; margin-right:230px;}
                            li.bottomnavbar {display:inline; font-family:arial, Sans Serif;}
            
            /*footer on all pages except homepage - link to aptana and copyright info*/
            div.footer {color:#b5b5b5; text-align:center; font-size:10px; margin-left:230px; font-family:arial, Sans Serif; margin-top:0px; margin-right:230px;}            
            
            /*continous navigation on left side of all pages except homepage*/
            ul.leftnavbar {border-right:gray; height:100%; color:#B3A062; list-style-type:none; margin-left:-25px; margin-top:50px;}
                            li.leftnavbar {display:block; font-family:arial, Sans Serif; font-size:15px;}
                            
            /*homepage navigation*/
            ul.centernav {color:#B3A062; font-family:arial, sans-serif;
                            font-size:40px; text-align:center; margin:200px; word-spacing:15px; list-style-type:none;} 
                            li {display:inline;}
and heres the pages code

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <title>Nick Hayden Portfolio</title>
        <link rel="stylesheet" type="text/css" href="/users/haydos/desktop/website/NickHaydenStyleSheet.css" / >
        <style type="text/css">
        
        /*image gallery for portfolio*/
            
            div.portfoliogallery     { 
                                    height:auto; width:auto; 
                                    float:left; text-align:center; 
                                    margin-top:75px; margin-left:50px; 
                                    }
                        
                        div.portfoliogallery img     {
                                                    display:inline; margin: 2px; 
                                                    border: 1px solid #ffffff;
                                                    }
                        
                        div.portfoliogallery a:hover img {border: 1px solid gray;}
                        
                        div.desc {text-align:center; font-weight:normal; width:120px; margin-left:25px; margin-left:75px;  }
            
            
        </style>
    </head>
        
    <body>
        <ul class="navbar"> <li class="navbar">Blog |</li>  <li class="navbar">About Us |</li> <li class="navbar">Portfolio |</li> 
                            <li class="navbar">Contact</li></ul>
        <ul class="leftnavbar" align=right><li class="leftnavbar"><br />Have A Read <br />With What I'm Doing
                                </li>  <li class="leftnavbar"><br />Where I Am and <br />Where I Want To Go</li> 
                                <li class="leftnavbar"><br />Some of My Previous Work</li> 
                                <li class="leftnavbar"><br />Shoot Me An Email and <br />We Can Have A Chat</li></ul>
                                
        <div class="body"><p>Here Is A Showcase of My Latest Work
                <div class="portfoliogallery"><a href="http://s9.photobucket.com/albums/a76/haydos/?action=view&current=Picture1.png" 
                            target="_blank"><img src="http://i9.photobucket.com/albums/a76/haydos/Picture1.png" border="0" alt="Nick Hayden"></a>
                                                </div><div class="desc">My Freelance Site</div>
                                            
                
                <div class="portfoliogallery"><a href="http://s9.photobucket.com/albums/a76/haydos/?action=view&current=Picture1-1.png" 
                target="_blank"><img src="http://i9.photobucket.com/albums/a76/haydos/Picture1-1.png" border="0" alt="Fourth Chamber"></a></div>
                        <div class="desc"> My Personal Blog</div>
                        
                <div class="portfoliogallery"><a href="http://s9.photobucket.com/albums/a76/haydos/?action=view&current=1222909676DJztsT-1.jpg" 
                target="_blank"><img src="http://i9.photobucket.com/albums/a76/haydos/1222909676DJztsT-1.jpg" border="0" alt="Coming Soon"></a>
                        <div class="desc">Coming soon</div>
                                                    
                        </div>
                
        <br /><br />
        <ul class="bottomnavbar"><li class="bottomnavbar">Blog |</li>  <li class="bottomnavbar">About Us |</li> <li class="bottomnavbar">Portfolio |</li> 
                                <li class="bottomnavbar">Contact</li></ul>
        <div class="footer"> Copyright Nick Hayden 2010 Onwards - Created In
                                <A href="http:www.aptana.com">Aptana Studio</A></div>
    </body>
</html>
NickH is offline
Reply With Quote
View Public Profile
 
Old 05-18-2010, 09:34 AM Re: Alignment Problem
Phunk Rabbit's Avatar
Ultra Talker

Posts: 255
Name: John Nerush
Location: Milton Keynes, UK
Trades: 0
Firstly, sort out your indentation and code presentation, it will make life alot better when you try to re-read your files and bug fix!

There are two errors with this code, can you spot them?

HTML Code:
<p>Here Is A Showcase of My Latest Work

<div class="portfoliogallery">
     <a href="http://s9.photobucket.com/albums/a76/haydos/?action=view&current=Picture1.png" target="_blank">
          <img src="http://i9.photobucket.com/albums/a76/haydos/Picture1.png" border="0" alt="Nick Hayden">
     </a>
</div>
<div class="desc">My Freelance Site</div>
                                            
                
<div class="portfoliogallery">
     <a href="http://s9.photobucket.com/albums/a76/haydos/?action=view&current=Picture1-1.png" target="_blank">
         <img src="http://i9.photobucket.com/albums/a76/haydos/Picture1-1.png" border="0" alt="Fourth Chamber">
     </a>
</div>
<div class="desc">My Personal Blog</div>
                        
<div class="portfoliogallery">
     <a href="http://s9.photobucket.com/albums/a76/haydos/?action=view&current=1222909676DJztsT-1.jpg" target="_blank">
          <img src="http://i9.photobucket.com/albums/a76/haydos/1222909676DJztsT-1.jpg" border="0" alt="Coming Soon">
     </a>
<div class="desc">Coming soon</div>
Answer (select the white text below):

1. Line 1 is missing the closing P tag.
2. Second from last div is missing its closing tag.
These errors could be avoided by running your site through the W3C Validator.


Now, im sure there will be a few more of these types of errors however im at work and dont have the time to go through the whole file. But now you know to look for them!

The <div>'s you are using to create the thumbnails should really be a list, example:

HTML Code:
<p>Here Is A Showcase of My Latest Work</p>
<ul id="portfoliogallery">
     <li><a href="link1"><img src="img1" alt="" /></a><span>Image 1 Description</span></li>
     <li><a href="link2"><img src="img2" alt=""  /></a><span>Image 2 Description</span></li>
     <li><a href="link3"><img src="img3" alt=""  /></a><span>Image 3 Description</span></li>
</ul>
Using CSS like:

Code:
#portfoliogallery,#portfoliogallery li {
     list-style:none;
     float:left;
}
#portfoliogallery {
     width:600px; /* I am using example figures */
}
#portfoliogallery li {
     width: 180px;
     margin: 10px;
}
#portfoliogallery li a img {
     border:none;
}
#portfoliogallery li span {
     float:left;
     width:170px;
     padding:10px 5px;
}
Obviously this is just a rough idea to get you towards the right direction, please note this is done of the top of my head so I cant bug test your or my code (due to restrictions at my workplace).

I hope this has helped in some way.

Last edited by LadynRed; 05-18-2010 at 03:08 PM.. Reason: To finish constructing
Phunk Rabbit is offline
Reply With Quote
View Public Profile Visit Phunk Rabbit's homepage!
 
Old 05-19-2010, 12:00 AM Re: Alignment Problem
NickH's Avatar
Extreme Talker

Posts: 155
Trades: 0
thanks heaps man
ill try that out in a few minutes and let you know how it goes
also - i never even knew about the w3c validator so huge thanks for that one
NickH is offline
Reply With Quote
View Public Profile
 
Old 05-19-2010, 03:20 AM Re: Alignment Problem
Phunk Rabbit's Avatar
Ultra Talker

Posts: 255
Name: John Nerush
Location: Milton Keynes, UK
Trades: 0
Quote:
Originally Posted by NickH View Post
thanks heaps man
ill try that out in a few minutes and let you know how it goes
also - i never even knew about the w3c validator so huge thanks for that one
Providing you are attempting to code to W3C standards then the validator is a valuble tool, if you are not interested in coding to W3C standards (you should be!) then it will give you a huge list of errors and put you off.

You can also validate your CSS, unless you do somthing really silly then this is an easy test to pass.

Like i said though, this is just a theory/example, it is going to take work to intergrate the idea into your site. It seems you do what i used to do, divs for everything and it can be a hard habbit to break.
Phunk Rabbit is offline
Reply With Quote
View Public Profile Visit Phunk Rabbit's homepage!
 
Old 05-19-2010, 03:56 AM Re: Alignment Problem
NickH's Avatar
Extreme Talker

Posts: 155
Trades: 0
divs just seemed like the logical thing to do, i guess mainly because i didnt/dont understand the code very well but it works now that it is in a list

now im just having some spacing issues site-wide but that doesnt seem to hard to fix
NickH is offline
Reply With Quote
View Public Profile
 
Old 05-19-2010, 04:07 AM Re: Alignment Problem
Phunk Rabbit's Avatar
Ultra Talker

Posts: 255
Name: John Nerush
Location: Milton Keynes, UK
Trades: 0
Hopfully, now you can see how condenced the code can become (the list rather than the div's) it will spur you to get your head around it
Phunk Rabbit is offline
Reply With Quote
View Public Profile Visit Phunk Rabbit's homepage!
 
Reply     « Reply to Alignment Problem
 

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.64404 seconds with 12 queries