Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
Like Tree1Likes
  • 1 Post By abduraooft

Thread: Centering images (margin) in a float:left

  1. #1
    Regular Coder
    Join Date
    Mar 2012
    Posts
    158
    Thanks
    21
    Thanked 0 Times in 0 Posts

    Centering images (margin) in a float:left

    I just cant seem to figure out how to center the image div for this gallery. I want the space on the left and right to be the same, mainly because on an ipad it displays 3 images per row but almost completely left. Ive done it before with inline-block I think but I cant seem to get that to work.
    Fabrics | Leisure Garden Specialty

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Why do you need those floats on images? How about dropping that float and then adding text-align:center; to .fabrics-page ?
    taymag likes this.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    taymag (06-16-2014)

  • #3
    Regular Coder
    Join Date
    Mar 2012
    Posts
    158
    Thanks
    21
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by abduraooft View Post
    Why do you need those floats on images? How about dropping that float and then adding text-align:center; to .fabrics-page ?
    That worked. I am so used to using float left because Wordpress adds a p tag to everything that when I put images up they just go down the page and each one usually gets returned. If I add the code with no spaces it works though. Thanks!

  • #4
    New Coder
    Join Date
    Aug 2011
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Cool Centering images

    Don't use float. You can use this to make it more compatible in all devices.

    position:absolute;
    width:100%;
    height:100%;
    text-align: center; /*handles the horizontal centering*/
    Own a Professional Website with stylish look at just 895$ Only! Visit: http://www.sanctify.in/

  • #5
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Quote Originally Posted by punitsahay View Post
    Don't use float. You can use this to make it more compatible in all devices.

    position:absolute;
    width:100%;
    height:100%;
    text-align: center; /*handles the horizontal centering*/
    This has nothing to do with OP.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

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