Skip to content

Instantly share code, notes, and snippets.

@SitesByYogi
SitesByYogi / descendants-selector.css
Created June 22, 2023 01:10
Selects elements that are descendants of another element.
.parent-class .child-class {
/* Styles applied to elements with class="child-class" within elements with class="parent-class" */
}
@SitesByYogi
SitesByYogi / id-selector.css
Created June 22, 2023 01:08
Selects a single element with a specific ID attribute.
#my-id {
/* Styles applied to the element with id="my-id" */
}
@SitesByYogi
SitesByYogi / class-selector.css
Created June 22, 2023 01:06
Selects elements with a specific class attribute.
.my-class {
/* Styles applied to elements with class="my-class" */
}
@SitesByYogi
SitesByYogi / element-selector.css
Created June 22, 2023 01:05
Selects elements based on their HTML tag.
p {
/* Styles applied to all <p> elements */
}
@SitesByYogi
SitesByYogi / syntax.css
Created June 22, 2023 00:57
CSS uses a simple syntax to define styles. Here's an example of CSS syntax:
selector {
property: value;
/* Add more properties as needed */
}
@SitesByYogi
SitesByYogi / style.css
Created June 22, 2023 00:42
Create a new file with a .css extension (e.g., styles.css), and link it to your HTML document:
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<p>This is a blue paragraph.</p>
</body>
@SitesByYogi
SitesByYogi / internal-css.html
Created June 22, 2023 00:40
Add internal CSS
<head>
<style>
p {
color: blue;
}
</style>
</head>
<body>
<p>This is a blue paragraph.</p>
</body>
@SitesByYogi
SitesByYogi / inline-css.html
Created June 22, 2023 00:39
CSS inline CSS
<p style="color: blue;">This is a blue paragraph.</p>
@SitesByYogi
SitesByYogi / list.html
Created June 22, 2023 00:34
HTML List Tag
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
<ol>
<li>Item 1</li>
<li>Item 2</li>
</ol>
@SitesByYogi
SitesByYogi / img.html
Created June 22, 2023 00:33
HTML Image tag
<img src="image.jpg" alt="Description of the image">