removing twitter icon on big Cartel footer nav - graphics

using Big Cartel Ranger theme. I would like to have the Mailing list at the top of my social links on the footer nav, preferably with an envelope icon. The reason it has the twitter icon is because it has been input via the basic Settings within big Cartel, and I have simply modified the title from Twitter to Mailing List via the layout code, see screengrab:
[]
Please be patient! I stumble my way through any code changes through trial and *mostly *error!
I have been in touch with Big Cartel support and they were asking me to remove the Layout code that relates to twitter (pasted below) and put a simple link in, which obviously didn't work. Below is the coding that relates to the twitter link on footernav.
{% if theme.twitter_url != blank or theme.facebook_url != blank or theme.instagram_url != blank or theme.tumblr_url != blank or theme.pinterest_url != blank %}
\<nav class="footernav"aria-label="Footer social media navigation"\>
\<div class="footer-nav-title"\>Social\</div\>
<ul class="social-icons">
{% if theme.twitter_url != blank %}
<li><a href="{{ theme.twitter_url }}" title="Mailing List">\<svg xmlns="http://www.w3.org/2000/svg
" width="24" height="24" viewBox="0 0 24 24"\>\<path d="M24 4.557c-.883.392-1.832.656-2.828.775 1.017-.61 1.798-1.574 2.165-2.724-.95.564-2.005.974-3.127 1.195-.897-.957-2.178-1.555-3.594-1.555-3.18 0-5.515 2.966-4.797 6.045C7.727 8.088 4.1 6.128 1.67 3.15.38 5.36 1.003 8.256 3.195 9.722c-.806-.026-1.566-.247-2.23-.616-.053 2.28 1.582 4.415 3.95 4.89-.693.188-1.452.232-2.224.084.626 1.957 2.444 3.38 4.6 3.42-2.07 1.623-4.678 2.348-7.29 2.04 2.18 1.397 4.768 2.212 7.548 2.212 9.142 0 14.307-7.72 13.995-14.646.962-.695 1.797-1.562 2.457-2.55z"/\>\</svg\>\<span\>Mailing List\</span\></a></li>
{% endif %}
As above, I simply amended the title to Mailing List from Twitter.
I also tried removing the w3.org link and inputting my image link, as follows: https://www.dropbox.com/s/rtxpa88q75wpmz2/Envelope.jpg?dl=0 but the icon remained.
I also removed everything from <svg to </svg> and that removed the icon.
I then tried to input my dropbox link and removing the <path to z"/> and it didn't change anything further.
I think it requires further change in CSS. There is one section that mention social icons and it appears all are 'locked in' within their w3.org link, in which case I don't think I can change it:
.footernav ul.social-icons {
list-style: none;
margin: 0;
padding: 0;
}
.footernav ul.social-icons li {
display: block;
}
.footernav ul.social-icons li a {
color: {{ theme.accent_text_color }};
display: block;
}
.footernav ul.social-icons li a span {
display: inline-block;
margin-left: 8px;
}
.footernav ul.social-icons li a svg {
\-webkit-transition: 0.1s ease-in-out;
transition: 0.1s ease-in-out;
display: inline-block;
fill: {{ theme.accent_text_color }};
height: 16px;
opacity: 0.6;
position: relative;
top: 3px;
width: 16px;
}
.footernav ul.social-icons li a:hover svg {
opacity: 1;
}
Any help appreciated, thanks in advance!

This one took me a while to figure out when I was editing my own icons, but it's easy to change! For this particular theme, there are two Twitter code bits you'll want to change under Layout.
So to switch the icons associated with the Twitter link, you'll want to take out this SVG code on or around lines 147 and 252 (depending on if you've implemented more code) of your Layout:
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M24 4.557c-.883.392-1.832.656-2.828.775 1.017-.61 1.798-1.574 2.165-2.724-.95.564-2.005.974-3.127 1.195-.897-.957-2.178-1.555-3.594-1.555-3.18 0-5.515 2.966-4.797 6.045C7.727 8.088 4.1 6.128 1.67 3.15.38 5.36 1.003 8.256 3.195 9.722c-.806-.026-1.566-.247-2.23-.616-.053 2.28 1.582 4.415 3.95 4.89-.693.188-1.452.232-2.224.084.626 1.957 2.444 3.38 4.6 3.42-2.07 1.623-4.678 2.348-7.29 2.04 2.18 1.397 4.768 2.212 7.548 2.212 9.142 0 14.307-7.72 13.995-14.646.962-.695 1.797-1.562 2.457-2.55z"/></svg>
Be sure to leave the < a > tags around them! Now, you'll want to replace those SVG code bits with the following in both places, to which I used a free envelope icon from Font Awesome:
<svg height="24" width="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.2.1 by #fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M48 64C21.5 64 0 85.5 0 112c0 15.1 7.1 29.3 19.2 38.4L236.8 313.6c11.4 8.5 27 8.5 38.4 0L492.8 150.4c12.1-9.1 19.2-23.3 19.2-38.4c0-26.5-21.5-48-48-48H48zM0 176V384c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V176L294.4 339.2c-22.8 17.1-54 17.1-76.8 0L0 176z"/></svg>
This should get you the results you're wanting with that envelope on both desktop and mobile. :) Let me know if this works for you!

Related

SVG text on 2 lines in mobile break the rules

I created an svg composit by a shape and a text over. I give the style to all the elements and works good EXCEPT for the mobile. In the simulator the text looks good but using smartphone to navigate the website the text doesn't follow the rules set.
This is the result from the simulator in Chrome desktop
And this is the real rendering in Chrome and Safari for iPhone
The second line (tspan) doesn't follow the y instruction (i also tested dy, but the result is the same) and brake the word after the first letter
The code is
<svg width="185" height="84" viewBox="0 0 185 84" fill="none" xmlns="http://www.w3.org/2000/svg">
<style>.wph-btn-ctg { font-family: Montserrat;
font-style: normal;
font-weight: bold;
font-size: 18px;
line-height: 22px;
align-items: center;
text-align: center;
text-transform: uppercase;
fill: #FFFFFF; }</style>
<a href="#">
<path opacity="0.5" d="M4.3071 33.4856C5.50854 32.6656 6.62989 32.0821 7.68716 31.5502C10.09 30.2132 12.2406 29.2677 14.3432 28.3665C16.4457 27.4653 18.4561 26.6971 20.4545 25.9436C24.4593 24.4663 28.3199 23.1071 32.2326 21.9104C40.042 19.5466 47.9756 17.8107 56.3416 17.9806C62.2207 18.6307 68.3881 18.2909 74.5555 17.8698C77.6312 17.6704 80.7389 17.4488 83.7305 17.301C86.7221 17.1533 89.5655 17.0351 92.3529 17.0277C89.0489 16.6288 85.7489 16.289 82.3408 16.0748C78.9327 15.8606 75.4125 15.7498 71.9283 15.7793C64.952 15.8384 57.9115 16.3555 50.883 17.1311C43.8546 17.9068 36.7701 18.9705 29.5855 20.2631C25.9811 20.9206 22.3768 21.6371 18.6083 22.5605C16.73 23.0258 14.8197 23.5429 12.8373 24.1634C11.8442 24.4884 10.8349 24.8282 9.78969 25.2345C8.74443 25.6408 7.67515 26.0766 6.54179 26.638C7.73732 23.3313 9.16776 20.3351 10.7949 17.7295C12.4109 15.1408 14.2972 13.19 16.3376 11.9973C21.4557 9.95113 26.2575 8.51808 30.9831 7.28448C35.7088 6.05088 40.3103 5.06843 44.8678 4.28542C45.004 6.02133 45.2683 9.41928 45.4005 11.1256C51.507 8.33321 57.7612 6.78502 64.0509 6.50887C70.1748 6.25141 76.3019 6.56205 82.4089 7.43962C85.3845 7.82373 88.2519 8.17829 91.1554 8.51069C94.0589 8.8431 96.9504 8.99084 99.8619 8.99823C105.788 9.10203 111.707 8.17456 117.539 6.22816C116.694 5.28265 117.207 3.87177 117.387 2.74897C117.551 1.76652 117.459 0.998297 115.969 0.976136C117.459 0.976136 117.551 1.76652 117.387 2.74897C111.5 3.08138 105.717 3.24388 99.978 3.25127C97.1106 3.25127 94.2511 3.21926 91.3997 3.15524C88.5403 3.08876 85.7049 2.99272 82.7934 2.87454C70.7549 2.46087 58.6564 2.57906 45.9051 4.12291C55.7689 2.42394 65.4085 1.41196 74.996 0.953977C77.3989 0.835787 79.7911 0.756989 82.1726 0.717593L89.0289 0.62156L102.549 0.39257C111.568 0.215286 120.615 0.0158425 129.782 0.00106884C138.949 -0.0137048 148.204 0.119258 157.707 0.739752L164.227 1.23466C165.805 2.64661 167.424 3.89689 169.077 4.97979C170.703 6.05088 172.301 6.88559 173.987 7.67598C175.673 8.46637 177.307 9.03516 179.005 9.53008C180.775 10.1063 182.545 10.5421 184.319 10.8819C183.158 15.0333 184.051 21.7775 183.518 26.7119C183.222 29.1495 182.629 31.1883 181.292 32.215C179.954 33.2418 177.892 33.2418 174.724 32.0008C174.656 33.7367 174.516 37.1716 174.447 38.9445C177.285 41.241 179.79 44.7354 181.76 49.1457C183.277 52.7534 184.147 57.1421 184.251 61.7033C184.338 63.696 184.22 65.701 183.903 67.6128C183.738 68.5257 183.533 69.4125 183.29 70.2646C183.072 71.1232 182.822 71.9526 182.541 72.7466C181.989 74.3046 181.305 75.6888 180.515 76.8463L180.218 77.26C180.111 77.4085 179.997 77.5395 179.878 77.6515C179.606 77.91 179.321 78.1612 179.021 78.3902C178.395 78.8678 177.75 79.2531 177.091 79.5425C175.421 80.1429 173.733 80.5622 172.037 80.7983C171.139 80.9238 170.27 80.9756 169.317 81.0568C168.364 81.1381 167.419 81.1602 166.45 81.1528C165.481 81.1454 164.508 81.1528 163.522 81.0642C162.537 80.9755 161.52 80.9682 160.487 80.8869C158.436 80.7318 156.378 80.4658 154.243 80.2516C145.773 79.2692 136.79 78.0873 128.18 79.6016C115.653 81.0273 103.098 82.645 90.5667 79.2101C88.4201 78.5674 86.2255 78.0356 84.0749 77.5924L82.473 77.2895L80.9151 77.0162C79.8779 76.8537 78.8326 76.7133 77.7874 76.5952C73.6023 76.1446 69.3773 76.0485 65.1482 76.115C56.702 76.2406 48.328 76.9276 40.2102 76.3662C37.2867 76.5434 33.5462 79.0033 30.3344 81.1307C28.9157 82.1283 27.466 82.9694 25.9932 83.6496C24.7396 84.1445 23.7144 84.174 22.9014 83.3541C21.9591 82.8215 21.1465 81.7012 20.6027 80.1851C20.029 78.5584 19.5966 76.7764 19.3211 74.9036C21.2394 73.5148 23.4301 72.2074 25.6688 71.0329C27.9074 69.8584 30.2302 68.8168 32.5811 67.8565C37.3255 65.944 42.1203 64.4844 46.9463 63.4835C58.981 61.9349 71.0708 62.7396 83.0136 65.8842C71.3156 61.3118 59.0529 60.9794 46.9463 63.4835C42.0805 64.0819 37.2387 65.02 32.4849 66.3422C30.1101 66.9997 27.7593 67.7679 25.4565 68.6395C23.1537 69.5112 20.911 70.5158 18.8406 71.6534C18.356 68.1668 17.9114 64.4955 16.6339 61.755C16.6339 61.755 15.9371 62.3016 15.1001 63.0403C14.277 63.7521 13.475 64.5436 12.6972 65.4115C11.7961 65.1677 10.9631 64.8649 10.1461 64.6063C9.33097 64.3111 8.50183 64.1676 7.67114 64.1779C7.24195 64.2041 6.81466 64.2955 6.39361 64.4512C5.9691 64.6285 5.54459 64.8722 5.1401 65.0938C4.33914 65.6626 3.57422 66.1206 2.87338 65.9286C2.17254 65.7365 1.51174 64.8649 1.03517 63.0625C0.923036 62.5823 0.814907 62.1834 0.722796 61.6885C0.627711 61.1682 0.555393 60.6346 0.506536 60.093C0.458478 59.4651 0.402409 58.9702 0.370371 58.394C0.337692 57.7927 0.325655 57.1883 0.334329 56.5842C0.377812 52.1311 0.823099 47.7224 1.65191 43.5391C2.52096 40.0525 3.36597 36.7284 4.3071 33.4856Z" fill="#DD6854"/>
<text x="90" y="30" text-anchor="middle" alignment-baseline="middle" class="wph-btn-ctg">TARGHE PER
<tspan x="90" y="60">PAGGETTO</tspan>
</text>
</a>
</svg>
I can't examinate the real rendering to understand where is the problem, looking at the code from chrome everythings seem to be correct.
Where am i doing the error?
It's a webkit bug! (not specific to apple safari)
Related to text-transform applied to svg <text><tspan> elements.
Quite baffling: this is a known issue since 2017!
webkit bugzilla report
Workaround: avoid text-transform
Just write your text in uppercase letters (you already did this) and
remove the text-transform:uppercase and everthing is fine.
Example snippet
<link href="https://fonts.googleapis.com/css2?family=Lato&family=Montserrat:wght#700" rel="stylesheet">
<svg width="185" height="84" viewBox="0 0 185 84" xmlns="http://www.w3.org/2000/svg">
<style>
.wph-btn-ctg {
font-family: Montserrat;
font-style: normal;
font-weight: bold;
font-size: 18px;
/* text-transform: uppercase; */
fill: #fff;
}
</style>
<a href="#">
<path opacity="0.5" d="M4.3 33.5c1.2-.8 2.3-1.4 3.4-1.9c2.4-1.3 4.6-2.3 6.7-3.2c2.1-.9 4.1-1.7 6.1-2.4c4-1.5 7.9-2.8 11.8-4c7.8-2.4 15.7-4.1 24.1-3.9c5.9 .7 12 .3 18.2-.1c3.1-.2 6.2-.4 9.2-.6c3-.1 5.8-.3 8.6-.3c-3.3-.4-6.6-.7-10-1c-3.4-.2-6.9-.3-10.4-.3c-7 .1-14 .6-21 1.4c-7 .8-14.1 1.8-21.3 3.1c-3.6 .7-7.2 1.4-11 2.3c-1.9 .5-3.8 1-5.8 1.6c-1 .3-2 .7-3 1.1c-1 .4-2.1 .8-3.2 1.4c1.2-3.3 2.6-6.3 4.3-8.9c1.6-2.6 3.5-4.5 5.5-5.7c5.1-2 9.9-3.5 14.6-4.7c4.7-1.2 9.3-2.2 13.9-3c0.1 1.7 .4 5.1 .5 6.8c6.1-2.8 12.4-4.3 18.7-4.6c6.1-.3 12.3 .1 18.4 .9c3 .4 5.8 .7 8.7 1.1c2.9 .3 5.8 .5 8.7 .5c5.9 .1 11.8-.8 17.7-2.8c-.8-.9-.3-2.4-.2-3.5c0.2-1 .1-1.8-1.4-1.8c1.5 0 1.6 .8 1.4 1.8c-5.9 .3-11.7 .5-17.4 .5c-2.9 0-5.7 0-8.6-.1c-2.9-.1-5.7-.2-8.6-.3c-12-.4-24.1-.3-36.9 1.2c9.9-1.7 19.5-2.7 29.1-3.2c2.4-.1 4.8-.2 7.2-.2l6.9-.1l13.5-.2c9-.2 18.1-.4 27.2-.4c9.2 0 18.4 .1 27.9 .7l6.5 .5c1.6 1.4 3.2 2.7 4.8 3.7c1.6 1.1 3.2 1.9 4.9 2.7c1.7 .8 3.3 1.4 5 1.9c1.8 .6 3.5 1 5.3 1.4c-1.2 4.2-.3 10.9-.8 15.8c-.3 2.4-.9 4.5-2.2 5.5c-1.3 1-3.4 1-6.6-.2c-.1 1.7-.2 5.2-.3 6.9c2.8 2.3 5.3 5.8 7.3 10.2c1.5 3.6 2.4 8 2.5 12.6c0.1 2 0 4-.3 5.9c-.2 .9-.4 1.8-.6 2.7c-.2 .9-.5 1.7-.7 2.5c-.6 1.6-1.2 2.9-2 4.1l-.3 .4c-.1 .1-.2 .3-.3 .4c-.3 .3-.6 .5-.9 .7c-.6 .5-1.3 .9-1.9 1.2c-1.7 .6-3.4 1-5.1 1.3c-.9 .1-1.8 .2-2.7 .3c-1 .1-1.9 .1-2.9 .1c-1 0-1.9 0-2.9-.1c-1-.1-2-.1-3-.2c-2.1-.2-4.1-.4-6.2-.6c-8.5-1-17.5-2.2-26.1-.6c-12.5 1.4-25.1 3-37.6-.4c-2.1-.6-4.3-1.2-6.5-1.6l-1.6-.3l-1.6-.3c-1-.2-2.1-.3-3.1-.4c-4.2-.5-8.4-.5-12.6-.5c-8.4 .1-16.8 .8-24.9 .3c-2.9 .2-6.7 2.6-9.9 4.8c-1.4 1-2.9 1.8-4.3 2.5c-1.3 .5-2.3 .5-3.1-.3c-.9-.5-1.8-1.7-2.3-3.2c-.6-1.6-1-3.4-1.3-5.3c1.9-1.4 4.1-2.7 6.3-3.9c2.2-1.2 4.6-2.2 6.9-3.2c4.7-1.9 9.5-3.4 14.4-4.4c12-1.5 24.1-.7 36.1 2.4c-11.7-4.6-24-4.9-36.1-2.4c-4.9 .6-9.7 1.5-14.5 2.9c-2.4 .7-4.7 1.4-7 2.3c-2.3 .9-4.5 1.9-6.6 3c-.5-3.5-.9-7.2-2.2-9.9c0 0-.7 .5-1.5 1.3c-.8 .7-1.6 1.5-2.4 2.4c-.9-.2-1.7-.5-2.6-.8c-.8-.3-1.6-.4-2.5-.4c-.4 0-.9 .1-1.3 .3c-.4 .2-.8 .4-1.3 .6c-.8 .6-1.6 1-2.3 .8c-.7-.2-1.4-1.1-1.8-2.9c-.1-.5-.2-.9-.3-1.4c-.1-.5-.2-1.1-.2-1.6c0-.6-.1-1.1-.1-1.7c0-.6 0-1.2 0-1.8c0-4.5 .5-8.9 1.3-13c0.9-3.5 1.7-6.8 2.7-10.1z" fill="#DD6854" />
<text x="90" y="30" text-anchor="middle" alignment-baseline="middle" class="wph-btn-ctg">
TARGHE PER
<tspan x="90" y="60">PAGGETTO</tspan>
</text>
</a>
</svg>
Debugging tip:
I could also reproduce this bug running a Linux based webkit browser in a virtual machine (Virtual Box, Linux Mint distribution, Epiphany and Midori).

Svg inside h1 tag

I have a Gatsby project, where where I would like to use an svg as my main heading.
import Header from "../images/header.svg"
return (
<h1>
<Header/>
</h1>
)
Thers is no text in the svg (the text is made purely using rects and paths), so what do I do in terms of accessibility and SEO optimization?
Two ways to address this, visually hidden text or by adding a <title> to your SVG.
Do not use aria-label as support is not great (you will see people recommending that for SVGs, aria-label does not tend to work well on static / non-interactive elements).
Visually Hidden text (screen reader only text)
Visually hidden text is not visible on the screen but will still be read by a screen reader.
Please use the CSS class below to visually hide text, it has better compatibility and is future proofed compared to most current "screen reader only" classes as explained in this answer I gave
.visually-hidden {
border: 0;
padding: 0;
margin: 0;
position: absolute !important;
height: 1px;
width: 1px;
overflow: hidden;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 - a 0 height clip, off to the bottom right of the visible 1px box */
clip: rect(1px, 1px, 1px, 1px); /*maybe deprecated but we need to support legacy browsers */
clip-path: inset(50%); /*modern browsers, clip-path works inwards from each corner*/
white-space: nowrap; /* added line to stop words getting smushed together (as they go onto seperate lines and some screen readers do not understand line feeds as a space */
}
<h1>
<span class="visually-hidden">Welcome To Our Site</span>
<svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512">
<path fill="#666" d="M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z">
</path>
</svg>
</h1>
important: notice how I add focusable="false" as well as aria-hidden="true" to the SVG, this is to fix a bug with Internet Explorer where SVGs are focusable and to hide the SVG from screen readers. I used a youtube icon to represent your text as that was the closest SVG I had to hand!
Add a <title> element to your SVG.
The <title> element is effectively the same as alt on a normal image. Using this gives the screen reader something to announce.
Obviously you would then remove the aria-hidden="true" from it so it can be read by a screen reader!
Update after comments to include best practices for <title> and or <desc>
Thanks to the comments I realised this answer was lacking some key information on how to correctly use a <title>.
In this answer I gave I referenced a series of tests by deque which show that the most reliable method for labelling an SVG for screen readers using WAI-ARIA was to use aria-labelledby and point that to the <title> (and <desc> if you have both).
So a rough idea of how to do this is as follows:
<h1>
<svg aria-labelledby="welcome-title" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512">
<title id="welcome-title">Welcome To Our Site</title>
<path fill="#666" d="M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z">
</path>
</svg>
</h1>
Which is better?
Go for visually hidden text.
It works all the way back to IE6 which predates SVG!
It also works in a text only browser (one that does not understand CSS) as it will still be displayed. It is an edge case but still a win for visually hidden text!

Center Aligning an SVG element?

I don't know how to really explain this but how can I center align this logo
http://jsfiddle.net/fa7w3h99/3/
I have tried the following but it didnt seem to work as intended.
.center-logo {
display: block;
margin: auto;
}
You will have to change the width, height, and viewbox attributes of your svg.
Here I'd say it should be :
width="135px" height="135px" viewBox="0 0 135 135"
jsfiddle

Jquery-Masonry almost always empty spaces

I've been trying Masonry but can't get it to work exactly as I wanted. The elements I use vary in width and height, but all fit in a grid (4 different sizes, all multiple of smallest+margins). I've also calculated a distribution of elements (7 of the smallest, 4 of all the others) that can fit precisely.
However it's rare that masonry manages to fit them neatly, sometimes there's one lurking at the bottom, sometimes several are misplaced. It's always so that in one view I can see what items need to be moved for it to fit.
Is there a way to make masonry more aggressive in moving elements? Or have it go over two times to make sure there are no empty spaces?
You should probably look at masonry's "big brother" Isotope here. Mind you, if you have elements that are sorted in a certain order or fixed in a certain order - and that are wider than a single column width - they can "block" a column at narrow browser widths.
EDIT Maybe this fiddle explains it a bit better. If you look at that one and - while observing the numbers in the divs - you see that the next masonry element up (the red element 5) can not possibly fit in the white square as it must come after element 4; so where it must end up means, that, with only three rows fitting, one gets a white gap. Maybe you can use Isotope's shuffle and/or reLayout methods and sacrifice ordering your elements in a strict order? Best would be a jsfiddle with your issue.
<article>
<div class="tile blue"><p>1</p></div>
<div class="tile black"><p>2</p></div>
<div class="tile tall yellow"><p>3</p></div>
<div class="tile grey"><p>4</p></div>
<div class="tile wide red"><p>5</p></div>
<div class="tile green"><p>6</p></div>
<div class="tile grey"><p>7</p></div>
<div class="tile blue"><p>8</p></div>
<div class="tile green"><p>9</p></div>
</article>
$('article').isotope({
itemSelector : '.tile',
masonry: {
columnWidth: 100
}
});
article .tile {
display: block;
float: left;
box-sizing: border-box;
width: 100px;
height: 100px;
font-size: 3em;
font-weight: 700;
padding: 0 6px;
color: #fff;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
border:1px dotted black;
}
article .tile.wide {
width: 200px;
}
article .tile.tall {
height: 200px;
}
.tile.yellow { background: yellow; }
.tile.red { background: red; }
.tile.blue { background: blue; }
.tile.black { background: black; }
.tile.grey { background: grey; }
.tile.green { background: green; }
To expand on Dan's answer, having just had this problem myself, it seems that Packery is a more up to date; much more maintained version of Masonry - from the same author. It's not clear to me why both projects exist as separate entities, with only typos fixed in the latter.
The good news is - it's almost totally a drop-in replacement. The only change I had to make (other than names masonry->packery where used) was to remove an option, because it is the default and only option in Packery.
That was isFitWidth: true, my feeble attempt to make Masonry pack things something close to how nicely Packery does without any options at all.
Another nice change with Packery is that gutter: x applies to vertical as well as horizontal gutters. In Masonry, this was horizontal only - though trivial with margin-bottom in CSS, this felt like a needless hack.

CSS Padding - Apparently I missed something

Lets say I have some markup like this:
<html>
<head>
<style type="text/css">
#container
{
margin: 0 auto;
width: 900px;
background: green;
}
</style>
</head>
<body>
<div id="container">
</div>
</body>
</html>
Imagine "container" is filled with hundreds of a's for testing purposes of padding.
Now, what I want to do is to make an area of whitespace between the edges of "container" and its content on the left and right hand sides. So I add:
padding-left: 50px;
padding-right: 50px;
Now from what I (thought) I understood, this would mean that if 100 a's fitted per line before, only 80 or so would fit now. In other words, "container" would remain the same width but grow downwards.
However, what I am seeing is that the size of "container" is increasing horizontally and not vertically.
How can I get "container" to grow down vertically and stay the same width horizontally?
You need to change the width to 800px and then add your padding. Padding is additive to the width.
W------W - original width
PW------WP - original width plus padding either side
PW----WP - smaller width plus padding either side
Box model courtesy of Can Berk Güder
What garry said, If youre using Chrome or Firebug plugin for Firefox you can right click and "inspect element" and see a visual representation of how your elemenent is being sized, really helps in these situations.
The affects of adding padding or margin to an element depend entirely on the browser you're viewing the page in. Padding and margin SHOULD be additive as Garry says but that's not the case with IE6 so you'll need to do some research around browser differences and how you can accommodate them in your style rules.
From what it looks like your doing you just want a padding to be applied to the whole page. You could do that by directly referencing body in your CSS. so you'll have -
body
{
padding:0 50 0 50;
}
You could also add a margin to anything inside the div:
<style type="text/css">
#container
{
margin: 0 auto;
width: 900px;
background: green;
}
#container *
{
margin-left: 50px;
margin-right: 50px;
}
</style>

Resources