diff options
Diffstat (limited to 'files/ko/learn/css/building_blocks/fundamental_css_comprehension/index.html')
-rw-r--r-- | files/ko/learn/css/building_blocks/fundamental_css_comprehension/index.html | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/files/ko/learn/css/building_blocks/fundamental_css_comprehension/index.html b/files/ko/learn/css/building_blocks/fundamental_css_comprehension/index.html new file mode 100644 index 0000000000..d16df40221 --- /dev/null +++ b/files/ko/learn/css/building_blocks/fundamental_css_comprehension/index.html @@ -0,0 +1,128 @@ +--- +title: 기본적인 CSS 이해 +slug: Learn/CSS/Introduction_to_CSS/기본적인_CSS_이해 +translation_of: Learn/CSS/Building_blocks/Fundamental_CSS_comprehension +--- +<div>{{LearnSidebar}}</div> + +<div>{{PreviousMenu("Learn/CSS/Introduction_to_CSS/Debugging_CSS", "Learn/CSS/Introduction_to_CSS")}}</div> + +<p class="summary">You've covered a lot in this module, so it must feel good to have reached the end! The final step before you move on is to attempt the assessment for the module — this involves a number of related exercises that must be completed in order to create the final design — a business card/gamer card/social media profile.</p> + +<table class="learn-box standard-table"> + <tbody> + <tr> + <th scope="row">Prerequisites:</th> + <td>Before attempting this assessment you should have already worked through all the articles in this module.</td> + </tr> + <tr> + <th scope="row">Objective:</th> + <td>To test comprehension of fundamental CSS theory, syntax and mechanics.</td> + </tr> + </tbody> +</table> + +<h2 id="Starting_point">Starting point</h2> + +<p>To get this assessment started, you should:</p> + +<ul> + <li>Go and grab the <a href="https://github.com/mdn/learning-area/blob/master/css/introduction-to-css/fundamental-css-comprehension/index.html">HTML file for the exercise</a>, and the <a href="https://github.com/mdn/learning-area/blob/master/css/introduction-to-css/fundamental-css-comprehension/chris.jpg">associated image file</a>, and save them in a new directory on your local computer. If you want to use your own image file and fill your own name in, you are welcome to — just make sure the image is square.</li> + <li>Grab the <a href="https://github.com/mdn/learning-area/blob/master/css/introduction-to-css/fundamental-css-comprehension/style-resources.txt">CSS resources text file</a> — this contains a set of raw selectors and rulesets that you'll need to study and combine to answer part of this assessment.</li> +</ul> + +<div class="note"> +<p><strong>Note</strong>: Alternatively, you could use a site like <a class="external external-icon" href="http://jsbin.com/">JSBin</a> or <a class="external external-icon" href="https://thimble.mozilla.org/">Thimble</a> to do your assessment. You could paste the HTML and fill in the CSS into one of these online editors, and use <a href="http://mdn.github.io/learning-area/css/introduction-to-css/fundamental-css-comprehension/chris.jpg">this URL</a> to point the <code><img></code> element to the image file. If the online editor you are using doesn't have a separate CSS panel, feel free to put it in a <code><style></code> element in the head of the document.</p> +</div> + +<h2 id="Project_brief">Project brief</h2> + +<p>You have been provided with some raw HTML and an image, and need to write the necessary CSS to style this into a nifty little online business card, which can perhaps double as a gamer card or social media profile. The following sections describe what you need to do.</p> + +<p>Basic setup:</p> + +<ul> + <li>First of all, create a new file in the same directory as your HTML and image files. Call it something really imaginative like <code>style.css</code>.</li> + <li>Link your CSS to your HTML file via a <code><link></code> element.</li> + <li>The first two rulesets in the CSS resource file are yours, for FREE! After you've finished rejoicing at your good fortune, copy and paste them into the top of your new CSS file. Use them as a test to make sure your CSS is properly applied to your HTML.</li> + <li>Above the two rules, add a CSS comment with some text inside it to indicate that this is a set of general styles for the overall page. "General page styles" would do. Also add three more comments at the bottom of the CSS file to indicate styles specific to the setup of the card container, styles specific to the header and footer, and styles specific to the main business card contents. From now on, subsequent styles added to the stylesheet should be organized in an appropriate place.</li> +</ul> + +<p>Taking care of the selectors and rulesets provided in the CSS resource file:</p> + +<ul> + <li>Next up, we'd like you to look at the four selectors, and calculate the specificity for each one. Write these down somewhere where they can be found later on, such as in a comment at the top of your CSS.</li> + <li>Now it's time to put the right selector on the right rule set! You've got four pairs of selector and ruleset to match in your CSS resources. Do this now, and add them to your CSS file. You need to: + <ul> + <li>Give the main card container a fixed width/height, solid background color, border, and border-radius (rounded corners!), amongst other things.</li> + <li>Give the header a background gradient that goes from darker to lighter, plus rounded corners that fit in with the rounded corners set on the main card container.</li> + <li>Give the footer a background gradient that goes from lighter to darker, plus rounded corners that fit in with the rounded corners set on the main card container.</li> + <li>Float the image to the right so that it sticks to the right hand side of the main business card contents, and give it a max-height of 100% (a clever trick that ensures that it will grow/shrink to stay the same height as its parent container, regardless of what height it becomes.)</li> + </ul> + </li> + <li>Beware! There are two errors in the provided rulesets. Using any technique that you know, track these down and fix them before moving on.</li> +</ul> + +<p>New rulesets you need to write:</p> + +<ul> + <li>Write a ruleset that targets both the card header, and card footer, giving them both a computed total height of 50px (including a content height of 30px and padding of 10px on all sides.) But express it in <code>em</code>s.</li> + <li>The default margin applied to the <code><h2></code> and <code><p></code> elements by the browser will interfere with our design, so write a rule that targets all these elements and sets their margin to 0.</li> + <li>To stop the image from spilling out of the main business card content (the <code><article></code> element), we need to give it a specific height. Set the <code><article></code>'s height to 120px, but expressed in <code>em</code>s. Also give it a background color of semi-transparent black, resulting in a slightly darker shade that lets the background red color shine through a bit too.</li> + <li>Write a ruleset that gives the <code><h2></code> an effective font size of 20px (but expressed in <code>em</code>s) and an appropriate line height to place it in the center of the header's content box. Recall from earlier that the content box height should be 30px — this gives you all the numbers you need to calculate the line height.</li> + <li>Write a ruleset that gives the <code><p></code> inside the footer an effective font size of 15px (but expressed in <code>em</code>s) and an appropriate line height to place it in the center of the footer's content box. Recall from earlier that the content box height should be 30px — this gives you all the numbers you need to calculate the line height.</li> + <li>As a last little touch, give the paragraph inside the <code><article></code> an appropriate padding value so that its left edge lines up with the <code><h2></code> and footer paragraph, and set its color to be fairly light so it is easy to read.</li> +</ul> + +<div class="note"> +<p><strong>Note</strong>: Bear in mind that the second ruleset sets <code>font-size: 10px;</code> on the <code><html></code> element — this means that for any descendants of <code><html></code>, an em will be equal to 10px rather than 16px as it is by default. (This is of course, provided the descendants in question don't have any ancestors sitting in between them and <code><html></code> in the hierarchy that have a different <code>font-size</code> set on them. This could affect the values you need, although in this simple example this is not an issue.)</p> +</div> + +<p>Other things to think about:</p> + +<ul> + <li>You'll get bonus marks if you write your CSS for maximum readability, with a separate declaration on each line.</li> + <li>You should include <code>.card</code> at the start of the selector chain in all your rules, so that these rules wouldn't interfere with the styling of any other elements if the business card were to be put on a page with a load of other content.</li> +</ul> + +<h2 id="Hints_and_tips">Hints and tips</h2> + +<ul> + <li>You don't need to edit the HTML in any way, except to apply the CSS to your HTML.</li> + <li>When trying to work out the <code>em</code> value you need to represent a certain pixel length, think about what base font size the root (<code><html></code>) element has, and what it needs to be multiplied by to get the desired value. That'll give you your em value, at least in a simple case like this.</li> +</ul> + +<h2 id="Example">Example</h2> + +<p>The following screenshot shows an example of what the finished design should look like:</p> + +<p><img alt="A view of the finished business card, show a reader header and footer, and a darker center panel containing the main details and image." src="https://mdn.mozillademos.org/files/12616/business-card.png" style="display: block; margin: 0 auto;"></p> + +<p> </p> + +<h2 id="Assessment">Assessment</h2> + +<p>If you are following this assessment as part of an organized course, you should be able to give your work to your teacher/mentor for marking. If you are self-learning, then you can get the marking guide fairly easily by asking on the <a href="https://discourse.mozilla.org/t/fundamental-css-comprehension-assessment/24682">discussion thread about this exercise</a>, or in the <a href="irc://irc.mozilla.org/mdn">#mdn</a> IRC channel on <a href="https://wiki.mozilla.org/IRC">Mozilla IRC</a>. Try the exercise first — there is nothing to be gained by cheating!</p> + +<p>{{PreviousMenu("Learn/CSS/Introduction_to_CSS/Debugging_CSS", "Learn/CSS/Introduction_to_CSS")}}</p> + +<p> </p> + +<h2 id="In_this_module">In this module</h2> + +<ul> + <li><a href="/en-US/docs/Learn/CSS/Introduction_to_CSS/How_CSS_works">How CSS works</a></li> + <li><a href="/en-US/docs/Learn/CSS/Introduction_to_CSS/Syntax">CSS syntax</a></li> + <li><a href="/en-US/docs/Learn/CSS/Introduction_to_CSS/Selectors">Selectors</a></li> + <li><a href="/en-US/docs/Learn/CSS/Introduction_to_CSS/Selectors/Simple_selectors">Simple selectors</a></li> + <li><a href="/en-US/docs/Learn/CSS/Introduction_to_CSS/Selectors/Attribute_selectors">Attribute selectors</a></li> + <li><a href="/en-US/docs/Learn/CSS/Introduction_to_CSS/Selectors/Pseudo-classes_and_pseudo-elements">Pseudo-classes and pseudo-elements</a></li> + <li><a href="/en-US/docs/Learn/CSS/Introduction_to_CSS/Selectors/Combinators_and_multiple_selectors">Combinators and multiple selectors</a></li> + <li><a href="/en-US/docs/Learn/CSS/Introduction_to_CSS/Values_and_units">CSS values and units</a></li> + <li><a href="/en-US/docs/Learn/CSS/Introduction_to_CSS/Cascade_and_inheritance">Cascade and inheritance</a></li> + <li><a href="/en-US/docs/Learn/CSS/Introduction_to_CSS/Box_model">The box model</a></li> + <li><a href="/en-US/docs/Learn/CSS/Introduction_to_CSS/Debugging_CSS">Debugging CSS</a></li> + <li><a href="/en-US/docs/Learn/CSS/Introduction_to_CSS/Fundamental_CSS_comprehension">Fundamental CSS comprehension</a></li> +</ul> + +<p> </p> |