• Stars
    star
    163
  • Rank 231,141 (Top 5 %)
  • Language
  • Created almost 3 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Notes I took when going through the course CSS for JavaScript Developers.

Fundamentals Recap:

  • Pseudo-elements — these selectors target elements in the DOM that we haven't explicitly created with HTML tags.

  • Use rems for typography due to the accessibility benefits. Users may higher their default browser font size.

Rendering Logic 1:

  • Browser treats inline elements as typography, hence line-height is applied to those elements.

  • Inline-block elements internally act like block elements, but externally act like inline elements. The parent container will treat it as an inline element, since it's external. But the element itself can be styled like a block.

  • Fit-content behaves like max-content, though if the content is too wide to fit in the parent, it add line-breaks as-needed.

  • There are 7 layout modes in CSS, such as Grid and Flexbox layout. In Flow layout, the default layout mode, every element will use a display value of either inline, block, or inline-block.

  • Only vertical margins collapse. Margin collapse is unique to Flow layout. Nesting elements doesn't prevent collapsing. Margins can collapse in the same direction. More than two margins can collapse.

  • Be aware of how you use margins. Don't set the specifically on components, in such cases it is better to use layout components. For reusable components, we want them to be as unopinionated as possible.

Rendering Logic 2:

  • If an absolute element does not have an anchor, it sits in its default in-flow position.

  • You can center a positioned element by giving it a margin of auto and setting an equal distance from each edge.

  • Positioned elements will always render on top of non-positioned ones. If both elements are using position, then the DOM order wins.

  • One way to create a stacking context is to set position absolute or relative and a z-index to an element. You can also use position fixed or sticky by itself. Another way would be to give the isolation property a value of isolate.

  • If a parent or grandparent uses the transform property, it becomes the containing block for the fixed element, essentially transforming it into an absolutely-positioned element.

  • With sticky positioning, the value of top/left/right/bottom controls the minimum gap between the element and the edge of the viewport while the container is in-frame.

Responsive and Behavioural CSS:

Typography and Images:

  • -webkit-line-clamp allows you to show ellipsis on a specific line of the text.

  • columns sets the number of columns to use when drawing an element's contents and those columns' width.

  • The text-indent CSS property sets the length of empty space (indentation) that is put before lines of text in a block.

  • You can get the benefits of self hosting fonts while still using the fonts from Google by downloading the font files and only using the "latin" font faces within the CSS file which contains the font faces.

  • You can get font weight from 100 to 900 by specifying it in the URL which Google Fonts give you. Example which includes doing it for italic and non-italic ones too: "Raleway:ital,wght@0,100..900;1,100..900".

  • object-fit can be used to set the size of an image (img). Cover value keeps its ratio and fills the entire space, you can even set specific width and height if the images have different ratios but you still want them to be of the same size.

  • object-position can be used to set the position of an image.

  • For background images, to render the approriate resolution of the image, you can use @media and check for the min-resolution, the value it should take in this case would be dots per Pixel, dppx, i.e. 2dppx. Safari doesn't support this property though, hence, in the @media rule, we also have to check for -webkit-min-device-pixel-ratio, which would be the syntax for Safari, though it takes simple numbers as value.

CSS Grid:

  • Default value of grid auto flow is row, can be set to column.

  • In CSS Grid, there's no such thing as a "primary axis" or a "cross axis". Rows are stacked on top of each other. Columns are inside the rows horizontally aligned beside each other.

  • Like display: flex, display: grid changes which layout mode its children use.

  • We can use repeat to avoid duplication. Takes in the amount in number as first argument and size as second, i.e. height or width.

  • Grids are composed of tracks and lines.

  • auto-fit will span the elements if remaining space exist. auto-fill will try to keep its minimum size and keep filling in new rows or columns, even if no elements are in those spaces.

  • repeat( auto-fill/fit, minmax(size, 1fr) );

  • For size you can use "min" which CSS offers in order to make sure the items don't overflow on smaller screens, example: grid-template-columns: repeat(auto-fit, minmax(min(320px, 100), 1fr)).

  • The place-content property will set both justify-content and align-content at the same time.

  • A grid child can use z-index even if it doesn't change the position property.

  • A trick: If your columns are growing beyond the viewport, you can use minmax(0px, auto) as value for them. This will ensure that the columns grows as needed, the width of their children, though will shrink to fit the viewport.

Animations:

  • When we use a percentage value in translate, that percentage refers to the element's own size, instead of the available space in the parent container.

  • Ease-out transition is often used when something is entering off the screen, starts fast but ends slow, as if something came hustling from far away.

  • Ease-in is for element that ends off screen.

  • Doom flicker behaviour: Transform the child of the element that you transformed, to avoid the flickering from appearing when wanting to transform the element.

  • Alternate direction ping-pongs between normal and reverse on subsequent iterations.

  • Backwards fill mode allows us to apply the animation's initial state backwards in time.

  • Fill mode of value "both" is best. The initial value is the start value of the animation, and the end of the animation, that value gets persisted.

  • The animation-play-state CSS property sets whether an animation is running or paused.

  • If you are using positoning such as bottom, top etc. and want your animation's transform to move in a specific direction, you may need to add the positioned value to the transform's translate.

  • Inline elements can't be animated, a solution is to set them to inline-block, then you can animate them.

  • Transform origin can help making an animation look more realistic.

  • Will-change lets us be intentional about which elements should be hardware-accelerated. Everything comes with trade-offs, be intentional where you use will-change. Use it on elements that actually animate!

  • You can achieve 3D transforms by using perspective. It is set on the parent of the element that gets transformed. The higher the value, the further a way the user is, the more it looks less 3D so to speak.

  • There is also the perspective() function which you can set within the transform, in order to set the perspective for a specific element.

  • The backface-visibility CSS property sets whether the back face of an element is visible when turned towards the user.

  • Whenever we are doing anything with the layout, it makes more sense to have a display of block compared to inline.

  • The transition's time within the state such as hover or active will be the one used when that particular state gets triggered. The original time and delay of the transition, set to the element, will be the one used once the element exists the state and returns back to its original position/style.

  • When we apply transform-style: preserve-3d, we create a 3D rendering context. This is similar in philosophy to a stacking context. Due to a Firefox bug you may need to set transform-style of inhert on the direct child of the parent which has transform-style.

  • Transitions look better if they are quicker when entering the state, and when leaving they are slower.

  • When adding overflow of hidden, add a comment why you put it there so you don't forget next time why you used it in that place.

Little Big Details:

  • Filter can do a lot of cool visual manipulations to the element.

  • Applying hue-rotate(60deg) increases the hue of all colours by 60deg.

  • You can clear like a blur glow effect on an element, i.e. an image. This requires you having both elements within a wrapper, centering both of them, and using blur on one of them. By having two or even more elements in a wrapper, you can accomplish quite neat things with the filter property.

  • Nested Radiuses. A common mistake people do is to set the same value of border radius for both elements, both parent and child. This makes the elements not using the same center point, hence it doesn't look right. We would have to sum up the inner circle's radius as well as any padding or other spacing. We can use CSS variables to add the padding to the inner radius to the parent, the radius the child element is using.

  • The first trick for cohesive shadows: every shadow on the page should share the same ratio. This will make it seem like every element is lit from the same very-far-away light source, like the sun.

  • By layering multiple shadows, we create a bit of the subtlety present in real-life shadows.

  • The ::selection CSS pseudo-element applies styles to the part of a document that has been highlighted by the user (such as clicking and dragging the mouse across text).

  • The backdrop-filter CSS property lets you apply graphical effects such as blurring or color shifting to the area behind an element.

  • We can increase the tap size of an element by using a pseudo element, that is absolutely positioned and has the values top, left, right and bottom set to the same negative value.

  • The pointer-events property allows us to set an element to be a hologram: you can see it, but you can't touch it.

  • The clip-path CSS property creates a clipping region that sets what part of an element should be shown. Parts that are inside the region are shown, while those outside are hidden.

  • You can animate and transition clip path, but it must have the same points, both before and afterward.

  • Polygon, first value of a point represents the X axis, the second value of a point represents the Y axis.

  • One straightforward way of transitioning or animating by using clip-path is to have the same elements within a parent, and for example on hover one will be revealed via clip-path, the element being revealed would have to have its position set to absolute.

  • Scroll snap. scroll-snap-type — this controls the direction and precision of the scroll snapping. scroll-snap-align — this controls which part of the child we want to snap.

  • The shape-outside CSS property defines a shape—which may be non-rectangular—around which adjacent inline content should wrap. It also accepts a URL. Is used in combination with the float property.

More Repositories

1

system-design-notes

Reading different stuff. Sharing links and notes. Having loads of fun.
142
star
2

gojo

A real-time multiplayer brainstorming web app built with Remix and Liveblocks.
HTML
56
star
3

Zod-from-scratch

Building zod from scratch to deepen my TypeScript knowledge.
TypeScript
36
star
4

data-intensive-apps

35
star
5

data-structures-and-algorithms-javascript

Data Structures and Algorithms implemented in JavaScript.
JavaScript
32
star
6

load-balancer

Built a basic load balancer
TypeScript
27
star
7

rate-limiter

I built and implemented 4 different Rate Limiting strategies with tests.
TypeScript
27
star
8

50-react-hooks

On a quest building and documenting 50 react hooks from scratch.
TypeScript
26
star
9

dns-resolver

Building a "basic" DNS resolver
TypeScript
24
star
10

Madara

✍️ A way for people to manage their tasks.
TypeScript
22
star
11

system-design-algo-notes

22
star
12

shisui

✍️ Become better than your past by regularly assessing yourself and holding yourself accountable.
TypeScript
21
star
13

remix-sockets-google-docs-simple

Simple google docs thing in Remix using socket.io.
TypeScript
20
star
14

css-secrets

My notes from the book CSS Secrets ✍️
16
star
15

Raveny

🍜 A website where people can find recipes and find them based on different criteria.
TypeScript
15
star
16

aws-notes

15
star
17

luffy

Todo App built with React, TypeScript, View Transition API and Context/Reducer Pattern.
TypeScript
13
star
18

redis-from-scratch

Redis Server and CLI from scratch
TypeScript
12
star
19

ts-toolbelt-from-scratch

Just having fun learning some juicy advanced TypeScript.
TypeScript
11
star
20

aws-glue-etl-snowflake

A full data (ETL) pipeline: S3, AWS Glue and Snowflake.
HCL
11
star
21

system-design-interviews

Notes related to system design interviews, step by step.
10
star
22

react-markdown-component

Markdown parser from scratch
TypeScript
10
star
23

kamuy

A chat app on the web inspired by WhatsApp Web.
TypeScript
9
star
24

web-performance-notes

JavaScript
9
star
25

kiba

A site where you can watch Naruto. Inspired by Netflix.
TypeScript
9
star
26

naru

Talk to Naruto and get real fucking advice.
TypeScript
8
star
27

patterns

Notes taken when reading the book Learning Patterns.
8
star
28

nagato

🎧 🎵 Listen to music with your friends.
TypeScript
8
star
29

react-notes

8
star
30

web-dev-notes

7
star
31

narutosstudent

6
star
32

refactoring-ui-notes

Notes I took while reading the book Refactoring UI.
6
star
33

engineering-diary

My public work engineering diary. Starting from 01-08-2022. Documenting each day once the work day has ended.
6
star
34

print-age

Simple CLI tool to print your age.
Rust
6
star
35

konoha

A simple way to search for Anime/Manga characters. 🦊
TypeScript
6
star
36

JSON-parser-scratch

TypeScript
6
star
37

load-tester

Load Tester is a tool to test a site/api's load e.g. how does your system perform under 1000 concurrent requests.
TypeScript
6
star
38

big-o-notation

Notes about Big O Notation.
5
star
39

data-structures

Data Structures in C.
C
5
star
40

framer-motion-notes

5
star
41

browser-and-javascript

Some notes related to the browser and javascript.
4
star
42

real-time-processing-kafka-kinesis

Real Time Data Streaming with Kafka (AWS MSK) and Kinesis
HCL
4
star
43

event-driven-aws-ecommerce

Event Driven Microservices :D
HCL
4
star
44

data-processing-with-lambda

Upload to S3 triggers Lambda Function
HCL
4
star
45

vegeta-playground

Vegeta's playground with AI suggestions.
TypeScript
4
star
46

all-my-notes

All MD notes of mine here.
4
star
47

learning-c

C
3
star
48

long-polling-and-web-socket

Notes about Long Polling and Web Socket. Establishing a persistent, real-time connection.
3
star
49

Gaara

Replicated twitter's tweet dialog UI.
TypeScript
3
star
50

sockets-remix-thread-prototype

Prototype of real-time comments and a proposal of how to make it "production-ready".
TypeScript
3
star
51

tube

A video sharing platform inspired by Youtube.
TypeScript
3
star
52

js-fundamentals-revision

3
star
53

snowflake-aws-glue-data-notes

pre study for ETL project
3
star
54

learn-terraform-aws-instance

Followed Terraform's tutorial and added much more!
HCL
3
star
55

copyjomi

An AI tool to help with writing content.
TypeScript
3
star
56

data-engineering-notes

My notes on data engineering.
3
star
57

vinland-saga

🥘 A platform where chefs can create and share recipes, and connect with each other.
TypeScript
3
star
58

javascript-web-notes

Notes about Web and JavaScript.
3
star
59

learning-and-problem-solving

Notes related to learning and solving problems.
3
star
60

typescript-practical-exercises

TypeScript
3
star
61

jirayia

A small drawing app to practice canvas.
TypeScript
2
star
62

form-data

Notes about FormData.
2
star
63

sage-mode-theme

Naruto Sage Mode VS Code Theme.
2
star
64

js-hard-parts

Notes related to JavaScript and some of its hard parts.
2
star
65

sort-javascript-notes

2
star
66

system-design-basics

Deep basics of system design.
2
star
67

accessible-design-notes

2
star
68

tigerabrodi

2
star
69

Customer-TypeScript-CLI

TypeScript
2
star
70

musashi

A markdown-notetaking app built with Remix and AWS.
TypeScript
2
star
71

javascript-date-math-notes

2
star
72

eBuy

A Platform for People to Buy and Sell Things, Created with MERN stack.
JavaScript
2
star
73

remix-twind-template

Remix Twind Template.
TypeScript
2
star
74

regex-engine-from-scratch

Let's build a Regex Engine!
TypeScript
2
star
75

levi-heichou

Something like Keybr but CLI.
C
2
star
76

abort-controller

Notes about Abort Controller, cancel ongoing request.
2
star
77

events-javascript

Notes related to events and javascript.
2
star
78

typescript-and-classes

Notes and playing around with code.
TypeScript
2
star
79

fun-ui-components

CSS
2
star
80

Boruto-1

TypeScript
2
star
81

javascript-prototype-chain-notes

1
star
82

deep-foundations-javascript

Deep foundations of JavaScript.
1
star
83

CMS

Simple CMS using NodeJS Express & EJS
JavaScript
1
star
84

minato

A way for people to search for food based on city 🍲
TypeScript
1
star
85

advanced-node-js

1
star
86

cors

Notes about CORS.
1
star
87

remix-basic-demo

Basic demo for internal presentation.
TypeScript
1
star
88

javascript-quiz

1
star
89

graphql-prisma-blog

A Blogging App created with GraphQL & Prisma, deployed using Prisma Cloud & Heroku, as for Database I used postgreSQL
JavaScript
1
star
90

json-test-api-react-context

I used json typicode in order to learn Context Api from React
JavaScript
1
star
91

data-structures-and-algorithms

My notes, digging into data structures and algorithms.
1
star
92

kafka-kinesis-notes

My notes on Kafka and Kinesis.
1
star
93

soft-skills-notes

1
star
94

refactoring-ui-notes-2

1
star
95

s3-data-lake

S3 as a data lake.
HCL
1
star
96

qooper-react-exercise

TodoApp built with React, Styled Components and more.
TypeScript
1
star
97

css-notes

Just some notes on writing good CSS.
1
star
98

node-and-performance

1
star
99

advent-of-code-2020

JavaScript
1
star
100

debugging-stories-notes

1
star