Things to remember CSS Flashcards
How to delay animations
transition-delay: 250ms;
How to deal with stuttered and glitched animations
will-change: transform;
Tells browser to use gpu and don’t detour through CPU
Most common Transitions and use
transition: ease-out; (for things entering the screen)
transition: ease-in; (for things exiting the screen)
transition: ease; (for general Animations without entering or exiting)
How to write Text vertical?
writing-mode: vertical-lr; (left-right)
writing-mode: vertical-rl; (right-left)
What is the shorthand Flex?
flex: (grow) (shrink) (basis);
The different border styles
none, hidden
dotted ….. , dashed —– , solid _____
double , groove , ridge
inset, outset
How to shift elements?
transform: translate (X, Y);
transform: translateX() or translateY ()
Implement different rules for screen sizes with media querrys
@media only screen and (max-with: 400px) -> for mobile e.g.
What is the diffrence between <div> and <span></span>
A <div> is a block-level element. A block-level element always starts on a new line. In a block layout, boxes are laid out one after the other, vertically, beginning at the top of a containing block.
While a <span> is a inline-level element, and layouted inline.</span>
What is the short hand in CSS Grid to define rows, columns and areas all at one?
grid-template: ;
It accepts rows, then a slsh then columns:
grid-template: 1fr
2fr
/ 2fr 1fr 2fr;
Putting each row on a new line helps resemble the layout.
How do items override there order of flow and go first in Grid?
row-positioned items are handled first, after which the Gtrid starts again from the top (instead continuing as usual).
item {
grid-row: 2;
}
How to change the placement of items in a Grid?
With order. Default is:
order: 0;
Higher numbers place it at the end, lower in front.
row-positioned items still have priority.
How to change the flow of the grid from rows to columns first?
grid-auto-flow: column;
How to fill in cells, Grid already skipped?
With
grid-auto-flow: dense;
(sparse is the default)
How to set up Grid Areas?
grid-template-areas: “. rocky rocky .”
“. . dunes .”
“. . dunes .”
“. . dunes .”;
Then on the item to place:
rocky {
grid-area: rocky;
What is implicit rows/columns default and how to change it?
By default addidtional created rows/coulmns have ‘auto’ as default. They collapse without content.
With
grid-auto-rows/columns: 100px (or 1fr etc.);
you can control the size of new ones.
How do items in a grid cell behave when given height or width in %?
The % units are relative to the grid cell rather than the grid container
How to place items horizontally in a grid cell?
justify-items: ;
(start, center, end, stretch)
How to override justify-items in CSS Grid?
justify-self ;
How to place items vertically in a grid cell?
align-items: ;
(start, center, end, stretch)
How to arrange Columns in CSS Grid if there is more space available than needed?
With
justify-content: ;
(start, center, end, space-between, space-evenly, space-around, stretch[auto columns])
How to arrange rows in CSS Grid if there is more space available than needed?
With
align-content: ;
(start, center, end, space-between, space-evenly, space-around, stretch[auto rowsalign])
What is destructured Assignment?
A way to pick out parts of an object or array to use it seperately.
const person = {name: ‘Alice’, age: 30, country: ‘USA’};
const {name,age} = person;
So the const declares name and age as values, which gets drafted from the person object.
How does the shorthand grid-area work?
It is short for grid-row/column start and end lines.
grid-area: 1 (row-start) / 1 (column-start) / 3 (row-end) / 3 (column-end);
it starts with the starting row line and goes clockwise from there.
Naming convention of classes in css?
.element-design
How can you use implicit rows/columns in the grid shorthand?
Witch auto-flow instead of fixed scales.
grid: auto-flow / auto-flow 10%;
There will be as many rows as content is there.
Same for columns. But they will all have 10% as size.
What is the syntax for variables in CSS?
:root {
–name-xy: red;
}
div {
color: var(–name-xy);
}
How to import css components into the style.css
@import url(“components/avatar.css”);
How to prevent buttons to overflow because of text padding?
display: inline-block;
How to size images to an container?
object-fit: cover
What flexbox CSS property enables flex-items to be displayed in several lines rather than trying to fit all in one line?
It’s flex-wrap: wrap; (default value: no-wrap).
How do you center the text of a div with Bootstrap?
<div class="text-center"></div>
What are the three Bootstrap CSS classes you have to know to design a grid?
container
row
col
How do you inline items of a list with Bootstrap?
*<ul class="list-inline">
<li><i></i></li>
<li><i></i></li>
<li><i></i></li>
</ul>*
How do you make an image circular with Bootstrap?
<img></img>
How do you align text content to the right in a div with Bootstrap?
<div class="text-end"></div>
What are the key words associated to size screen in the Bootstrap grid?
> col- (extra small) for smartphones
col-sm- (small) for tablets
col-md- (medium) for laptops
col-lg- (large) for desk screen
col-xl- (extra large) for screens >= 1200px
col-xxl- (extra extra large) for screens >= 1400px
How do you turn an image into a thumbnail with Bootstrap?
<img></img>
What are the main use cases for a modal?
Bring a form to the user or deliver a confirmation message. Use with caution.
How do you create a centered div with the width of half the screen on any device?
*<div class="container">
<div>
<div>
Hello world!
</div>
</div>
</div>*
How do you round corners of an image with Bootstrap?
/img src=”example.png” class=”rounded”/
Which Bootstrap class make your form inputs look nicer (full-width, rounder edges, etc.)?
The form-control class
You have two buttons with text in it. You want the buttons to have the same width, independent from the text and you want the text not to wrap rather than the buttons. What do you use?
flex: 1 «_space;Flexbasis;
min-width: fit-content;
How can you flip an image horizontally using CSS?
transform: scaleX(-1)
Which property is used to prevent user interaction with an element in CSS?
pointer-events: none;
What CSS property can be used to add smooth scrolling behavior to a webpage
scroll-behavior: smooth;
How do you create snapping effects in carousels or listings?
Use scroll-snap-type and scroll-snap-align
How do you apply a gradient to text?
background-clip: text and set color: transparent;