Search
JavaScript Glossary: Array .shift() Method
8.2.2019
Basics
This method takes out the first element from an array and returns it. The shift method mutates the array during this process, reducing its length
JavaScript Glossary: Array .push() Method
8.2.2019
Basics
This methods appends one or more value to the last position of an array. This method mutates the array returning the new length of the array.
let
JavaScript Glossary: Array .pop() Method
8.2.2019
Basics
This method takes out the last element from an array and returns it. The pop method mutates the array during this process reducing its length
JavaScript Glossary: Array .forEach() Method
8.2.2019
Basics
The forEach() method takes a function that performs an action on each of the elements in this array.
[1, 2, 3, 4, 5].forEach(functio
How do you figure?
1.2.2019
Scott O'Hara digs into the <figure> and <figcaption> elements. Gotta love a good ol' HTML deep dive.
I use these on just about every blog post here on CSS-Tricks, and as I've suspected, I've basically been doing it wrong forever. My original thinking was that a figcaption was just...
Using Artificial Intelligence to Generate Alt Text on Images
1.2.2019
Web developers and content editors alike often forget or ignore one of the most important parts of making a website accessible and SEO performant: image alt text. You know, that seemingly small image attribute that describes an image:
<img src="/cute/sloth/image.jpg" alt="A brown baby sloth...
Multiple Background Clip
30.1.2019
You know how you can have multiple backgrounds?
body {
background-image:
url(image-one.jpg),
url(image-two.jpg);
}
That's just background-image. You can set their position too, as you might expect. We'll shorthand it:
body {
background:
url(image-one.jpg) no-repeat top right,
...
New CodePen Feature: Prefill Embeds
21.1.2019
I've very excited to have this feature released for CodePen. It's very progressive enhancement friendly in the sense that you can take any <pre> block of HTML, CSS, and JavaScript (or any combination of them) and enhance it into an embed, meaning you can see the rendered output. It also...
Does it mutate?
18.1.2019
This little site by Remy Sharp's makes it clear whether or not a JavaScript method changes the original array (aka mutates) or not.
I was actually bitten by this the other day. I needed the last element from an array, so I remembered .pop() and used it.
const arr = ["doe", "ray", "mee"];
const...
Using React Portals to Render Children Outside the DOM Hierarchy
15.1.2019
Say we need to render a child element into a React application. Easy right? That child is mounted to the nearest DOM element and rendered inside of it as a result.
render() {
return (
<div>
// Child to render inside of the div
</div>
);
}
But! What if we want...
Algorithmic Layouts
10.1.2019
Don't miss this video by Heydon that digs into CSS layouts. It's great how he combines fundamental knowledge, like the way elements flow, wrap, and can have margin with new layout methods like flexbox and grid (with specific examples). Of particular note is the clear demonstration of how flexbox...
Toggling Animations On and Off
9.1.2019
A nicely detailed tutorial by Kirupa that gets into how you might provide a UI with persisted options that control whether animations run or not.
The trick is custom properties that control the movement:
body {
--toggle: 0;
--playState: "paused";
}
Which are used within animations...
Regarding CSS’s Global Scope
20.12.2018
html {
font-family: Roboto, sans-serif;
}
With the except of some form elements, you've just set a font on every bit of text on a site! Nice! That's probably what you were trying to do, because of the probably hundreds of elements all over your site, setting that font-family every time would...
The Fragmented, But Evolving State of CSS-in-JS
20.12.2018
TLDR: The CSS-in-JS community has converged on a consistent API.
Not so long ago, a Facebook engineer compiled a list of the available CSS-in-JS methodologies. It wasn’t short:
aphrodite, babel-plugin-css-in-js, babel-plugin-pre-style, bloody-react-styled, classy, csjs, css-constructor, css-light...
Build Your First Angular Website: Contact Form Validations
30.8.2018
We've created our contact form and are able to submit it using the processForm() method on our class:
<!-- form goes here -->
<form (ngSub
Gelato Festival – vzrušujúci deň pre celú rodinu v Designer Outlet Parndorf
27.6.2018
Zažite podujatie výnimočného charakteru a navštívte 6. a 7. júla Gelato Festival. Tešte sa na extravagantné kreácie zo zmrzliny od tých najlepších výrobcov a nechajte sa prekvapiť vynikajúcimi druhmi. Od mesta k mestu sú zmrzlinári ich remeselná zručnosť stredobodom súťaže. Porota pozostáva...
How to use Error Boundaries in React 16
26.6.2018
Have you seen these in your console?
Cannot read property ‘getHostNode’ of null ????
TypeError: Cannot re
Don’t Use The Placeholder Attribute
22.6.2018
Eric Bailey takes a hardline position on <input placeholder>.
You might be thinking, as I did: yeah, yeah I know the pitfalls. I'm capable of using placeholder responsibly. But when you look at all the negatives together:
Can’t be automatically translated;
Is oftentimes used in place of...
What the heck is "Script error?"
22.6.2018
If you’ve done any work with the JavaScript onerror event before, you’ve probably come across the following:
"Script error."
“Script error” is what brows
Kúpele Sonnetherme – oddych pre celú rodinu
18.6.2018
Celá rakúska oblasť Neusiedlersee je preslávená svojimi termálnymi kúpeľmi. Prirodzene sa tu nachádza veľké množstvo wellness rezortov. Kúpele Sonnentherme ležiaca východne od Lutzmannsburg sú z nich pravdepodobne najznámejšie. Čo tu nájdete? Niečo pre fanúšikov adrenalínu Zábavný vodný park...