Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Foundation Images

Foundation Images

Foundation provides responsive images, and you can create thumbnails and image popups:

Try it »


Thumbnails

in Add outside the element element to make the image an anchor link.

in Add in the tag .th class to set the image as a thumbnail. Hovering over it will show a light blue border:

Example

<

a

href=

"paris.jpg"

class=

"th"

<

img

src=

"paris.jpg"

alt=

"Paris"

<

/a

Try it »

| Note | **Responsive Images
**
In Foundation, images are responsive by default. We can resize the browser on the example page to see the image scaling effect. | | --- | --- |


Rounded Images

We can in .th add to the class .radius class to set a rounded thumbnail:

Example

<

a

href=

"paris.jpg"

class=

"th radius"

 

<

img

src=

"paris.jpg"

alt=

"Paris"

<

/a

Try it »


Simple Popup

Foundation can easily implement image popups.

To create a popup you can, in the

    element, add the .clearing-thumbs class and data-clearing attribute. In the
      add a list of images inside.

      Note: Image popups require JavaScript. So you need to initialize Foundation JS before using it.

      Example

      <
      
      ul
      
      class=
      
      "clearing-thumbs"
      
      data-clearing
      
      <
      
      li
      
      <
      
      a
      
      href=
      
      "rock600x400.jpg"
      
      class=
      
      "th"
      
      <
      
      img
      
      src=
      
      "rock200x100.jpg"
      
      <
      
      /a
      
      <
      
      /li
      
      <
      
      li
      
      <
      
      a
      
      href=
      
      "skies600x400.jpg"
      
      class=
      
      "th"
      
      <
      
      img
      
      src=
      
      "skies200x100.jpg"
      
      <
      
      /a
      
      <
      
      /li
      
      <
      
      li
      
      <
      
      a
      
      href=
      
      "lights600x400.jpg"
      
      class=
      
      "th"
      
      <
      
      img
      
      src=
      
      "lights200x100.jpg"
      
      <
      
      /a
      
      <
      
      /li
      
      <
      
      /ul
      
      <
      
      script

      $(document).ready(function() {

          $(document).foundation();

      })

      <

      /script

      Try it »


      Image Text Description

      You can add data-caption attribute to each image to set the image's description:

      Example

      <
      
      ul
      
      class=
      
      "clearing-thumbs"
      
      data-clearing
      
      <
      
      li
      
      <
      
      a
      
      href=
      
      "rock600x400.jpg"
      
      class=
      
      "th"
      
      <
      
      img
      
      data-caption=

      "The Pulpit Rock"

      src=

      "rock200x100.jpg"

      <
      
      /a
      
      <
      
      /li
      
      <
      
      li
      
      <
      
      a
      
      href=
      
      "skies600x400.jpg"
      
      class=
      
      "th"
      
      <
      
      img
      
      data-caption=

      "Sunrise Skies"

      src=

      "skies200x100.jpg"

      <
      
      /a
      
      <
      
      /li
      
      <
      
      li
      
      <
      
      a
      
      href=
      
      "lights600x400.jpg"
      
      class=
      
      "th"
      
      <
      
      img
      
      data-caption=

      "Northern Lights"

      src=

      "lights200x100.jpg"

      <
      
      /a
      
      <
      
      /li
      
      <
      
      /ul

      Try it »

      Note Tip: You can add HTML elements in the data-caption attribute, such as data-caption="

      Pulpit Rock

      Located in Norway

      "

      Displaying Only One Thumbnail

      When you need to display only one thumbnail, you can, in the

        Using it in .clearing-feature class and in the
      • Using it in .clearing-featured-img class.

        Example

        <
        
        ul
        
        class=

        "clearing-thumbs clearing-feature"

        data-clearing

         

        <
        
        li
        
        <
        
        a
        
        href=
        
        "rock600x400.jpg"
        
        class=
        
        "th"
        
        <
        
        img
        
        data-caption=

        "The Pulpit Rock"

        src=

        "rock200x100.jpg"

        <
        
        /a
        
        <
        
        /li
        
        <
        
        li
        
        <
        
        a
        
        href=
        
        "skies600x400.jpg"
        
        class=
        
        "th"
        
        <
        
        img
        
        data-caption=

        "Sunrise Skies"

        src=

        "skies200x100.jpg"

        <
        
        /a
        
        <
        
        /li
        
        <
        
        li
        
        class=
        
        "clearing-featured-img"
        
        <
        
        a
        
        href=
        
        "lights600x400.jpg"
        
        class=
        
        "th"
        
        <
        
        img
        
        data-caption=

        "Northern Lights"

        src=

        "lights200x100.jpg"

        <
        
        /a
        
        <
        
        /li
        
        <
        
        /ul

        Try it »