nginx rule for easy digital downloads
rewrite ^/wp-content/uploads/edd/(.*)\.zip$ / permanent;
by Skyler
by Skyler
.element:before{ content: ''; position: absolute; display:block; height: 100%; background: somecolor; opacity: 1; top: 0; left: -10px; right: -10px; z-index: -1; }
by Skyler
.element:before{ content: ''; position: absolute; display: block; height: 100%; width: 100%; background: url('path/to/svg.svg'); background-size: contain; background-position: center; background-repeat: no-repeat; background: somecolor; opacity: 1; top: 0; left: 0; }Source — modified from original use case by https://www.oakharborwebdesigns.com/
by Skyler
.element{ background: url('/path/to/image.jpg'); background-size: cover; background-position: center; background-repeat: no-repeat; }
by Skyler
Invite to exercise more
by Skyler
<picture> <source media="(max-width: 600px)" srcset="image-mobile.jpg" type="image/webp"> <source media="(min-width: 601px)" srcset="image.jpg" type="image/webp"> <source srcset="image.png" type="image/png"> <img aria-hidden="true" src="image.png" alt="image description" width="100" height="100"> </picture>
by Skyler
@font-face { font-family: 'MyFontName'; src: url('path/to/font-file.woff2') format('woff2'); }You can repeat the src: line if you want a fallback format (ttf, woff) In the CSS rule:
p { font-family: 'MyFontName', Helvetica, Arial, sans-serif; }The long and short on font formats is that there are a bunch. Use woff2 and be done. Source: https://www.oakharborwebdesigns.com/blog/articles/how-to-optimize-a-website.html, https://youtu.be/zK-yy6C2Nck, and others
by Skyler
<?php if(current_user_can('manage_options')){ echo "<pre>"; // var_dump($stuff); echo "</pre>"; }
by Skyler
RewriteEngine On RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} ^www\. [NC] RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC] RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]Reference: https://stackoverflow.com/questions/1478173/htaccess-redirect-www-to-non-www-with-ssl-https#answer-47890904
by Skyler
.element { display: grid; place-items: center; }Center an element horizontally and vertically using flexbox:
.parent { display: flex; align-items: center; justify-content: center; }Center a block element horizontally – common for inline elements set as block (ex, img) for this purpose:
.image { display: block; margin: auto; }Center inline (text, span, heading, etc…) elements horizontally:
.txt { text-align: center; }Horizontally enter an element relative to the viewport:
.element{ position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); }Horizontally center absolutely positioned element: *Remember to set parent to position:relative.
.child{ position: absolute; left: 50%; transform: translateX(50%); }Horizontally center absolutely-positioned element within another absolutely-positioned element:
.child{ left: 0; right: 0; margin: auto; }Horizontally center an inline or inline-block element (common use-case is pseudo elements):
.element:before{ content: ''; }