What's this?
Here lies all interesting stuff I find about CSS. These would include all bugs, errors, fixes, and other technical information that I could find useful in my development journey.
dev-2024-05-05-Making CSS Interactive | 06:42:32 PM
Link to original
Link to original
As stated above, this code block styles the page to “look similar on mobile as it does on a desktop or laptop.”
dev-2024-05-06-Putting a Link in CSS | 01:38:52 PM
dev-2024-05-06-Displaying an Inline Block | 02:06:07 PM
We can use the following to display an inline block in CSS:
selector-here {
display: inline-block;
}
An inline block fixes the problem of working with block-level elements and text-align
whereby the block-level element acts in a way that fills up the entirety of the block-level
element. Refer to this for more context.
dev-2024-05-06-Adding hover, active, and visited looks for a link | 04:09:35 PM
Refer to this for preliminary context. Here’s how it works:
CSS adds visited, hover, and active properties to a selector as follows. Say, for example, we have a selector for a <p>
with the following attribute: class="for-css"
, and we wanted to change its look for when it’s on hover, active, and visited.
It will look like this, when we modify it in the styles.css
sheet of my project:
p.for-css:hover {
color: black;
}
p.for-css:active{
color: brown;
}
p.for-css:visited {
color: black;
}
dev-2024-05-07-What it means to have two values in the CSS margin property | 11:17:22 AM
Link to originalWhat it means to have two values in the CSS margin property:
This also works for the padding property!
If there are two values in a margin property, they set the margin values of top & bottom, left & right. Here’s a code snippet to understand it more. Say we have an HTML p
element with the attribute class="something"
, and we wanted to add a 10px auto
value in its margin
:
It would look something like this in the HTML file:
<p class="something">style me, please!</p>
In the CSS stylesheet, it would look like this:
p.something {
margin: 10px auto;
}
If there were two values and, say, we wanted to create a CSS attribute that sets the margin-top
& margin-bottom
to 20px
, and marign-left
and margin-right
to 10px
. It would look like this:
p.something {
margin: 20px auto 10px auto;
}
dev-2024-05-07-Color hexadecimal values | 11:57:21 AM
Color hexadecimal values
dev-2024-05-07-using HSL in CSS | 12:01:00 PM
Using HSL in CSS
dev-2024-05-08-A simple use-case for a linear gradient in CSS: | 10:02:12 AM
Link to originalA simple use-case for a linear gradient in CSS:
dev-2024-05-09-the CSS vh attribute | 10:41:31 PM
Link to originalThe CSS
vh
attribute
As it states, tie
Link to originalvh
unit stands for “viewport height”. A height of100vh
, then, is equivalent to 100% of the viewport’s height.
dev-2024-05-11-Selecting the last element of a specific type: | 08:53:37 PM
Link to originalSelecting the last element of a specific type:
We can select the last element of a specific type using the CSS pseudo-class
last-of-type
. This pseudo-class is to be appended into an existing CSS selector, like so:
p:last-of-type
, wherep
is the element type from which we are selecting. After selecting, we can move forward to specifying CSS attributes for the entire selector.
dev-2024-05-12-Linking a stylesheet to an HTML file | 10:22:45 PM
Link to original
<link rel="stylesheet" href="./{{stylesheet-here}}">
dev-2024-05-16-The difference between a block element and an inline-block | 08:54:25 PM
Link to originalThe difference of a block element and an inline-block:
Block: A block element takes up the full width available, and has a line break before and after it. Inline: An inline element does not have line break before and after it, and only takes up as much width as necessary.
Click here for reference.
dev-2024-05-19-Blurring something in CSS using the filter attribute | 09:27:17 PM
Link to originalBlurring something in CSS using the filter attribute:
When blurring a selector in CSS, we must use the following syntax:
filter: blur({{blur-amount}});
dev-2024-05-19-Rounding the edges of a div | 09:33:56 PM
Link to originalRounding the edges of a div
When rounding the edges of a div, we must use the following syntax:
border-radius: {{amount-here}};
We must note that the
border-radius
CSS attribute takes the following format:
top-left
top-right
bottom-right
bottom-left
The values must not have a comma in between each.
dev-2024-05-19-Rotating a CSS Selector | 09:40:07 PM
Link to originalRotating a CSS selector:
We must use the following syntax to rotate something in CSS:
transform: rotate({{value-in-deg}});