Results 1 to 9 of 9

Thread: homepage images format goes wrong on smaller screen size

  1. #1
    Join Date
    Mar 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default homepage images format goes wrong on smaller screen size

    my problem im having is when i view my website on a latptop my homepage layout doesnt look right. it has 2 images at the top and then each one underneath it. obviously this isnt what i want. on my screen i can see what it normally looks like. you can see it at www.bleanphotos.co.uk

    i have attached the image of how it looks when you view the website on a laptop. could someone please help me on what i would need to do as im not too great at this. i have also attached a txt file of my css (that corosponds to my home page) so you can see what the problems are.

    thanks for reading

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    read here - I suspect it's a matter of screen resolution, your laptop screen is too small to show all the images with their margins, so some images are "wrapped" to the next line.

    If you let them float with inline-block (as described in the linked article) -and- leave off the static margins, you'll be able to allow them to rearrange themselves to fit the screen size smoothly.

  3. #3
    Join Date
    Mar 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks for that. when i do this:

    Code:
    #menu_images {
    	width:auto;
    	padding: 0 0 20px;
    	margin-left:-100px;
    	margin-top:-40px;
    	display:inline-block;
    }
    it works on the screen. but if i get rid of the fixed margins it goes funny again.

  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    sorry, I meant get rid of the individual margins, such as
    Code:
    #miscellany
    {
    	height:195px;
    	width:280px;
    	float:left;
    	margin-left:-585px;
    	margin-top:265px;
    }
    Just give everything a smaller margin (say, 10px) for spacing between items, instead of for positioning.

    In fact, you should probably eliminate all of those #id entries completely - the width and height are already defined in the <img> tag, the float is unnecessary (and potentially problematic), and the margins (also problematic) will be handled in the new css (below).

    Try this model:

    PHP Code:
    <div id="menu_images">
        <
    ul>
            <
    li class="inline">
                <
    div id="buildings" class="menu">
                    <
    a href="Buildings.php">
                        <
    img src="Menu_Images/Buildings.png" width="280" height="195" alt="Buildings" />
                    </
    a>
                </
    div>
            </
    li>
            <
    li>
                <!-- 
    other image div -->
            </
    li>
            <!-- 
    etc. -->
        </
    ul>
    </
    div
    with this css:
    Code:
        li.inline {
    		display: -moz-inline-stack;
    		display: inline-block;
    		vertical-align: top;
    		margin: 10px;
    		zoom: 1;
    		*display: inline;
        }
    Looks pretty good from early testing (try resizing the browser window to see what happens)
    Last edited by traq; 03-15-2010 at 02:32 AM.

  5. #5
    Join Date
    Mar 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks for the code. i couldnt seem to get it to work for some reason. ive gone down a different route.

    ive changed my css to this:

    Code:
    /*nav
    #menu_images {
    	width:auto;
    	padding: 0 0 20px;
    	margin-left:-100px;
    	margin-top:-40px;
    	display:inline-block;
    }
    */
    
    #buildings {
    	height:195px;
    	width:280px;
    	float:left;
    /*margin-left:155px;*/
    	margin-top:45px;
    }
    the only problem now is if you look at my website at www.bleanphotos.co.uk the images are over to the left. i want them to go into the centre of the wrapper. any ideas?

    thanks

    EDIT: Ive tried marging it but that just made it look worse. so i dont know how i would sort it out
    Last edited by saunders1989; 03-15-2010 at 11:43 AM.

  6. #6
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    You might try wrapping all of your images in a div with text-align: center.

    I haven't looked through all your css, but there seem to be some overlapping classes/ids/definitions, so there may be a conflict somewhere that's preventing something else from working properly. I'd suggest cleaning it all up, if just to prevent future problems.

    Let me know if you'd like to try and figure out the inline-block solution.

  7. #7
    Join Date
    Mar 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    what ive done is the text-align:centre and that seemed to be working. what is the difference between the inline-block version? is that considered better practice?

  8. #8
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    inline-block would be another solution for your floats (centering is a separate issue). The floats should work fine - your images are all exactly the same size, so they shouldn't jumble each other up. You might have problems in IE / older versions of IE if you ever have a left margin along with a left float, so I would personally consider inline-block a better solution. But if your version does what you want, then that means it works fine.

  9. #9
    Join Date
    Mar 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    oh okay thanks for that. i wanna learn what i can so i can understand different methods on how to do stuff. ohhh i used to do float:left and then have a left margin but ive started doing float:left and then margin:0 10px 0 0; which is i think better

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •