One of many HTML parts that ceaselessly comes into collision with CSS is the img
aspect. As we discovered in Request Metrics’ Fixing Cumulative Format Shift Issues on DavidWalshBlog article, offering picture dimensions throughout the picture
tag will assist to enhance your web site’s rating. However in a world the place responsive design is king, we want CSS and HTML to work collectively.
Most responsive design fashion changes are executed by way of max-width
values, however while you present a top
worth to your picture, you may get a distorted picture. The aim ought to all the time be a show pictures in relative dimensions. So how can we make sure the top
attribute would not battle with max-width
values?
The reply is as simple as top: auto
!
/* assuming any media question */ img { /* Make sure the picture would not go offscreen */ max-width: 500px; /* Make sure the picture top is responsive no matter HTML attribute */ top: auto; }
The dance to please customers and search engines like google is all the time a enjoyable steadiness. CSS and HTML had been by no means meant to battle however in some instances they do. Use this code to optimize for each customers and search engines like google!
Serving Fonts from CDN
For max efficiency, everyone knows we should put our belongings on CDN (one other area). Together with these belongings are customized internet fonts. Sadly customized internet fonts by way of CDN (or any cross-domain font request) do not work in Firefox or Web Explorer (accurately so, by spec) although…
Responsive Photographs: The Final Information
Likelihood is that any Net designers utilizing our Ghostlab browser testing app, which permits seamless testing throughout all units concurrently, could have labored with responsive design in some form or kind. And as at present’s web sites and units turn into ever extra diversified, a plethora of responsive pictures…
Verify All/None Checkboxes Utilizing MooTools
There’s nothing worse than having to click on each checkbox in an inventory. Why not enable customers to click on one merchandise and each checkbox turns into checked? Here is the best way to do exactly that with MooTools 1.2. The XHTML Word the picture with the ucuc ID — that…
Fade Photographs with MooTools LazyLoad
I just lately obtained an e mail from a MooTools developer asking an important query about my LazyLoad class: ”I am utilizing your LazyLoad MooTools plugin (which is nice, by the best way). I’ve been attempting to determine the best way to modify it so that after a picture scrolls into…