html - I thought using a percentage in margin would be responsive -


so @ moment, i'm trying center 3 social media icons in footer of website nicely.

so instead of using margin , pixels, not responsive when viewed on smaller screens ofcourse, tried using percentages, thought made responsive. thought percentage of screen calculated, resulting in same percentage distance on different screens different widths..

as can see on website (http://riksblog.com/marnik/index.html) not case when resizing..

can please clear out how make responsive , why combination of percentages , margin isn't correctly working when resizing?

how can make sure 3 logo's centered on every device?

solution center multiple images in footer , margin between them:

.footer {    width: 100%;  }    .logo-container {    margin: auto;    width: 320px;    text-align: center;   /* can set lowest bound,     * or can change based on breakpoint    */  }    .logo {    margin: 0 10px; /*or whatever spacing need*/  }
<div class="footer">     <div class="logo-container">       <img src="logo/path" class="logo">       <img src="logo/path" class="logo">       <img src="logo/path" class="logo">     </div>  </div>

the percentage based of parent container width.

here, if want them centered put them parent container , give width, have set margin auto center it.

so should work

html

<div class="footer">    <div class="logo-container">      <img src="logo/path" class="logo">      <img src="logo/path" class="logo">      <img src="logo/path" class="logo">    </div> </div> 

css

.footer {   width: 100%; }  .logo-container {   margin: auto;   width: 320px;   text-align: center;  /* can set lowest bound,    * or can change based on breakpoint   */ }  .logo {   margin: 0 10px; /*or whatever spacing need*/ } 

as stated in comments either set width minimum width (assuming fits smallest screen size/etc). above we're doing 2 things. 1 putting images in container, , having them center w/ text-align: center. take container, , center align using margin:auto.

here's ex fiddle: http://jsfiddle.net/7med35md/


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -