www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Client-Side Development > CSS

    CSS Discussion and technical support relating to Cascading Style Sheets.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 11-05-2009, 01:24 AM
    grainspirit grainspirit is offline
    Registered User
     
    Join Date: Aug 2009
    Posts: 20
    Vertically center align page: Unable to fix from other examples

    Please view my horizontal website - www.anishaacharya.com

    My CSS follows. I've looked up many tuts and egs to vertically center align but haven't been able to fix it! What I need is for the gallery of images to be vertically center aligned. Desperately looking for a fix!

    Code:
    /*  
    Theme Name: Hyku Photo Gallery
    Theme URI: http://hyku.com/wp-themes/
    Description: A horizontal scrolling theme for photos
    Version: 1.0
    Author: Josh Hallett
    Author URI: http://hyku.com/
    
    */
    
    body {
    background: 
    background-repeat: repeat;
    font-size: 0px; 
    font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif; text-align: left;
    }
    a {color: #ebebeb; text-decoration: none;}
    a:hover {text-decoration: none; color: #666;}
    #header {text-transform: uppercase; letter-spacing: 2px; margin: 0px 0 0 0px;}
    #gallery {width: 29000px; margin: 0px 0px 0px 0px;}
    #single-image {width: 100%; margin: 0px 0px 0px 0px;}
    #photos {margin: 0px 0 0 0;}
    .photo {display: inline; vertical-align: middle;}
    .image {float: left; width: 1000px; vertical-align: middle;}
    .meta {margin: 0px 0px 0px 0px; border-left: 0px dotted #666; padding: 0 0 0 0px; line-height: 0px; vertical-align: middle;}
    h2 {font-size: 0px;}
    .navigation {float: right; padding: 0px 0px 0 0; vertical-align: middle;}
    .pagenavigation {clear: both; margin: 0px 0px 0 0px; vertical-align: middle;}
    Reply With Quote
      #2  
    Old 11-05-2009, 03:04 AM
    kaafmim's Avatar
    kaafmim kaafmim is offline
    Registered User
     
    Join Date: Nov 2009
    Posts: 32
    My friend, vertical-align doesn't do anything on an inline element. You should use display:table-cell instead and then vertical-align:middle.

    But, this can be difficult to handle. A much simpler way is using this for your container:
    (I see that the height of your image is 600px so)

    #gallery {
    display: absolute;
    top: 50%;
    margin-top: -300px;
    }

    Hope it helps!

    Last edited by kaafmim; 11-05-2009 at 03:13 AM.
    Reply With Quote
      #3  
    Old 11-05-2009, 06:04 AM
    grainspirit grainspirit is offline
    Registered User
     
    Join Date: Aug 2009
    Posts: 20
    Thank you kaafmim. I tried what you said. The images are moving half out of the window at the top

    Last edited by grainspirit; 11-05-2009 at 06:08 AM.
    Reply With Quote
      #4  
    Old 11-05-2009, 10:36 AM
    kaafmim's Avatar
    kaafmim kaafmim is offline
    Registered User
     
    Join Date: Nov 2009
    Posts: 32
    Sorry my friend, I checked and saw that I have had a mistake, this is the right code. I checked it on your website.

    Code:
    #gallery {
    position: absolute;
    top: 50%;
    margin-top: -300px;
    }
    Reply With Quote
      #5  
    Old 11-05-2009, 11:08 AM
    grainspirit grainspirit is offline
    Registered User
     
    Join Date: Aug 2009
    Posts: 20
    This is great kaafmim! I am really grateful to you..Thank you so much..

    I realised a new issue now though. If the screen size is lesser than 600px in height, the image is getting cut off from the top. You can view www.anishaacharya.com now in a minimised (smaller) window to see what im talking about!
    Reply With Quote
      #6  
    Old 11-05-2009, 03:42 PM
    kaafmim's Avatar
    kaafmim kaafmim is offline
    Registered User
     
    Join Date: Nov 2009
    Posts: 32
    You are welcome my friend. You can solve this new problem with adding a min-height:600px; to the definition of the #gallery.
    something like this:

    Code:
    #gallery {
    position: absolute;
    top: 50%;
    margin-top: -300px;
    min-height:600px;
    }
    Good luck!
    Reply With Quote
      #7  
    Old 11-06-2009, 12:32 AM
    grainspirit grainspirit is offline
    Registered User
     
    Join Date: Aug 2009
    Posts: 20
    I'm sorry to be a bug, but adding min-height:600px; to the gallery is not fixing it...I've added it now but if you look at the site, (www.anishaacharya.com), and reduce the window size to a small window, you'll find that the images are getting cut at the top. Sorry kaafmim. Is there any way to scale down images if height of window is lesser than 600px?
    Reply With Quote
      #8  
    Old 11-06-2009, 03:03 AM
    kaafmim's Avatar
    kaafmim kaafmim is offline
    Registered User
     
    Join Date: Nov 2009
    Posts: 32
    Add the margin to the height may help you to get the proper results. try min-height:900px; But this won't help you to scale the images.

    Yes, there is a pure css solution for that. You should create a css class like this:

    Code:
    .resize {
    height: 100%;
    width:auto;
    }
    and apply it to your images, like this:

    [code]
    <img src="something.jpg" class="resize">
    </code]

    This will automatically resize the image, keeping the aspect ratio.
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    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 Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 05:14 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.