-
Notifications
You must be signed in to change notification settings - Fork 22.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(css): Move CSS examples - Learn CSS, How To, Flexbox basics (#3…
…6661) * chore(css): Move CSS examples - Getting started with CSS * chore(css): Move CSS examples - How CSS is structured * chore(css): Move CSS examples - Styling a biography page * chore(css): Move CSS examples - How to add a shadow to an element * chore(css): Move CSS examples - How to add a shadow to text * chore(css): Move CSS examples - How to center an item * chore(css): Move CSS examples - How to fill a box with an image without distorting it * chore(css): Move CSS examples - How to highlight the first line of a paragraph * chore(css): Move CSS examples - How to highlight the first paragraph * chore(css): Move CSS examples - How to highlight a paragraph that comes after a heading * chore(css): Move CSS examples - How to make a box semi-transparent * chore(css): Move CSS examples - How to fade a button on hover * chore(css): Move CSS examples - Basic concepts of flexbox * chore(css): Move CSS examples - Controlling ratios of flex items along the main axis
- Loading branch information
Showing
14 changed files
with
907 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,10 @@ page-type: learn-module-assessment | |
|
||
With the things you have learned in the last few lessons you should find that you can format simple text documents using CSS to add your own style to them. This assessment gives you a chance to do that. | ||
|
||
> [!NOTE] | ||
> You can click "Play" in the live samples below to open the code in the MDN Playground, or you can copy and paste the code into your own IDE or an online editor such as [CodePen](https://codepen.io/), [JSFiddle](https://jsfiddle.net/), or [Glitch](https://glitch.com/). | ||
> If you get stuck, you can reach out to us in one of our [communication channels](/en-US/docs/MDN/Community/Communication_channels). | ||
<table> | ||
<tbody> | ||
<tr> | ||
|
@@ -28,18 +32,9 @@ With the things you have learned in the last few lessons you should find that yo | |
</tbody> | ||
</table> | ||
|
||
## Starting point | ||
|
||
You can work in the live editor below, or you can [download the starting point file](https://github.com/mdn/css-examples/blob/main/learn/getting-started/biog-download.html) to work with in your own editor. This is a single page containing both the HTML and the starting point CSS (in the head of the document). If you prefer you could move this CSS to a separate file and link to it when you create the example on your local computer. | ||
|
||
> [!NOTE] | ||
> You can try solutions in the interactive editors on this page or in an online editor such as [CodePen](https://codepen.io/), [JSFiddle](https://jsfiddle.net/), or [Glitch](https://glitch.com/). | ||
> | ||
> If you get stuck, you can reach out to us in one of our [communication channels](/en-US/docs/MDN/Community/Communication_channels). | ||
## Project brief | ||
|
||
The following live example shows a biography, which has been styled using CSS. The CSS properties that are used are as follows — each one links to its property page on MDN, which will give you more examples of its use. | ||
The following live sample shows a biography, which has been styled using CSS. The CSS properties that are used are as follows — each one links to its property page on MDN, which will give you more examples of its use. | ||
|
||
- {{cssxref("font-family")}} | ||
- {{cssxref("color")}} | ||
|
@@ -49,7 +44,7 @@ The following live example shows a biography, which has been styled using CSS. T | |
- {{cssxref("font-style")}} | ||
- {{cssxref("text-decoration")}} | ||
|
||
In the interactive editor you will find some CSS already in place. This selects parts of the document using element selectors, classes, and pseudo-classes. Make the following changes to this CSS: | ||
In the example, there is some CSS already in place which selects parts of the document using element selectors, classes, and pseudo-classes. Make the following changes to this CSS: | ||
|
||
1. Make the level one heading pink, using the CSS color keyword `hotpink`. | ||
2. Give the heading a 10px dotted {{cssxref("border-bottom")}} which uses the CSS color keyword `purple`. | ||
|
@@ -69,6 +64,62 @@ You should end up with something like this image. | |
|
||
![Screenshot of how the example should look after completing the assessment.](learn-css-basics-assessment.png) | ||
|
||
{{EmbedGHLiveSample("css-examples/learn/getting-started/biog.html", '100%', 1600)}} | ||
Here are HTML and CSS code blocks and the result of combining them: | ||
|
||
```html live-sample___biog | ||
<h1>Jane Doe</h1> | ||
<div class="job-title">Web Developer</div> | ||
<p> | ||
Far far away, behind the word mountains, far from the countries Vokalia and | ||
Consonantia, there live the blind texts. Separated they live in Bookmarksgrove | ||
right at the coast of the Semantics, a large language ocean. | ||
</p> | ||
|
||
<p> | ||
A small river named Duden flows by their place and supplies it with the | ||
necessary regelialia. It is a paradisematic country, in which roasted parts of | ||
sentences fly into your mouth. | ||
</p> | ||
|
||
<h2>Contact information</h2> | ||
<ul> | ||
<li>Email: <a href="mailto:[email protected]">[email protected]</a></li> | ||
<li>Web: <a href="http://example.com">http://example.com</a></li> | ||
<li>Tel: 123 45678</li> | ||
</ul> | ||
``` | ||
|
||
```css live-sample___biog | ||
body { | ||
font-family: Arial, Helvetica, sans-serif; | ||
} | ||
|
||
h1 { | ||
color: #375e97; | ||
font-size: 2em; | ||
font-family: Georgia, "Times New Roman", Times, serif; | ||
border-bottom: 1px solid #375e97; | ||
} | ||
|
||
h2 { | ||
font-size: 1.5em; | ||
} | ||
|
||
.job-title { | ||
color: #999999; | ||
font-weight: bold; | ||
} | ||
|
||
a:link, | ||
a:visited { | ||
color: #fb6542; | ||
} | ||
|
||
a:hover { | ||
text-decoration: none; | ||
} | ||
``` | ||
|
||
{{EmbedLiveSample("biog", "", "400px")}} | ||
|
||
{{PreviousMenu("Learn/CSS/First_steps/How_CSS_works", "Learn/CSS/First_steps")}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.