Results 1 to 8 of 8

Thread: responsive icon cols

  1. #1
    Join Date
    Nov 2011
    Posts
    74
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default responsive icon cols

    i have nine icons that i want to cover the full width of the page and as the page scales down i want them to go under each other but what i gave done doesnt seem to work. I have only set one device size so far until i get it working

    Code:
    <style type="text/css">
    .icon-full-width {	padding: 10px;
    }
    
    .icon-div {
    	padding: 1%;
    	width: 9%;
    	float: left;
    }
    /* Smartphones (portrait and landscape) ----------- */
    @media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
    .icon-div {
    	display: block;
    }
    </style>

    Code:
    <div class="icon-full-width">
      <div class="icon-div"><img src="images/icons/icon.png" width="56" height="55" >icon label</div>
      <div class="icon-div"><img src="images/icons/icon.png" width="56" height="55" >icon label</div>
      <div class="icon-div"><img src="images/icons/icon.png" width="56" height="55" >icon label</div>
      <div class="icon-div"><img src="images/icons/icon.png" width="56" height="55" >icon label</div>
      <div class="icon-div"><img src="images/icons/icon.png" width="56" height="55" >icon label</div>
      <div class="icon-div"><img src="images/icons/icon.png" width="56" height="55" >icon label</div>
      <div class="icon-div"><img src="images/icons/icon.png" width="56" height="55" >icon label</div>
      <div class="icon-div"><img src="images/icons/icon.png" width="56" height="55" >icon label</div>
      <div class="icon-div"><img src="images/icons/icon.png" width="56" height="55" >icon label</div>
      </div>

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    You have to change/remove width:9%; because its currently in the global scope of all CSS so icons are always going to be 9% of their container.

    Try moving/setting it to inside your media queries, with a different value at your chosen breakpoints. A higher value will cause the icons to wrap sooner.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  3. #3
    Join Date
    Jan 2009
    Location
    NH
    Posts
    675
    Thanks
    98
    Thanked 26 Times in 26 Posts

    Default

    Bev thwir height and width are only numbers, there is no px or em or anything

  4. #4
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Quote Originally Posted by mlegg View Post
    Bev thwir height and width are only numbers, there is no px or em or anything
    What's your point? (BTW they are pixels)
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  5. #5
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    Quote Originally Posted by Beverleyh View Post
    What's your point?
    He mistakenly means that in something like <img src="images/icons/icon.png" width="56" height="55" > the pixels are missing.
    Mlegg, you can do this for images. The attribute 'width' is allowed on element img (but not, for instance on element div). It's even forbidden to do width=56px.
    But you can / must do: <img alt="" src="images/icons/icon.png" style="width: 56px; height: 55px" >

  6. #6
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Quote Originally Posted by molendijk View Post
    He mistakenly means that in something like <img src="images/icons/icon.png" width="56" height="55" > the pixels are missing.
    I surmised that's what he meant but I don't know what the point is in relation to the OP's question.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  7. #7
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    The point in relation to jonniefreak's question is that if width="56" height="55" were incorrect (which it is not), then that might explain (in mlegg's mind) the problem.

  8. #8
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    One can only guess. Ho hum
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

Similar Threads

  1. Need help to change icon to image background - DD Icon Menu
    By john7911 in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 02-08-2016, 08:05 PM
  2. Replies: 5
    Last Post: 10-18-2014, 08:21 AM
  3. using phpmyadmin to order cols
    By james438 in forum Other
    Replies: 4
    Last Post: 08-23-2010, 02:27 AM
  4. two ID cols
    By james438 in forum MySQL and other databases
    Replies: 3
    Last Post: 09-05-2007, 05:27 AM
  5. How to set table cols and rows
    By sinox in forum MySQL and other databases
    Replies: 2
    Last Post: 05-24-2007, 05:14 AM

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
  •