CSS, SCSS Flashcards
Pseudo-element that is the first/last child of the selected element. It is often used to <b>add cosmetic content</b> to an element.
::before, ::after
example:
a::after {
content: “→”;
}
what is overflow and what are the kinds
The overflow shorthand CSS property sets what to do when an element’s content is too big to fit in its block formatting context. It is a shorthand for overflow-x and overflow-y.
/* Keyword values */
overflow: visible;
overflow: hidden;
overflow: clip;
overflow: scroll;
overflow: auto;
overflow: hidden visible;
Placing span at a specific position in div
Span is not a block level element, so you can’t position it relative to another element.
Make it a div with style
position:absolute;
then, for example:
right:0;
bottom:0;
text-align:right’
Make sure that the containing div has style=”position:relative;” to contain the absolute object.
What is aria-hidden=”true”?
Adding aria-hidden=”true” to an element removes that element and all of its children from the accessibility tree. This can improve the experience for assistive technology users by hiding:
purely decorative content, such as icons or images duplicated content, such as repeated text offscreen or collapsed content, such as menus
What is a white-space CSS property and what are the kinds?
The white-space CSS property sets how white space inside an element is handled.
white-space: normal; white-space: nowrap; white-space: pre; white-space: pre-wrap; white-space: pre-line; white-space: break-spaces;
How to change cursor?
cursor: pointer;
cursor: auto;
How to detect a touch device with only CSS?
/* smartphones, touchscreens */ @media (hover: none) and (pointer: coarse) { /* ... */ } /* stylus-based screens */ @media (hover: none) and (pointer: fine) { /* ... */ } /* Nintendo Wii controller, Microsoft Kinect */ @media (hover: hover) and (pointer: coarse) { /* ... */ } /* mouse, touch pad */ @media (hover: hover) and (pointer: fine) { /* ... */ }
How to hide something behind the right screen edge?
#Sidebar { position: fixed; width: 30%; height: 100%; top: 0; right: 0; transform: translateX(100%); border: 1px solid red; transition: transform 5s; /* This is slow for demonstration purposes */ }
#Sidebar.open { transform: translateX(0); }
How to flip text vertically?
transform: rotate(270deg);
transform-origin: right bottom 0;
How to align icon <i>?</i>
top: 5px;
left: 5px;
How to make a dot in css?
<span></span>
.dot { height: 25px; width: 25px; background-color: #bbb; border-radius: 50%; display: inline-block; }
underline below span?
border-bottom: 2px solid $blue;