Css Demystified Start Writing Css With Confidence Review
CSS can seem intimidating at first, but with practice and patience, you can become confident in your ability to write CSS code. Remember to understand the basics, essential concepts, and best practices, and don't be afraid to experiment and try new things.
A CSS file consists of a series of rules, each comprising a selector, properties, and values. The selector targets the HTML element(s) you want to style, while the properties and values define the styles applied to those elements.
/* Rule A: Score 1 (tag) */ p color: blue;
: The transparent space inside the element, separating the content from the border. Border : The line wrapping around the padding and content. CSS Demystified Start writing CSS with confidence
.card padding: 1rem;
If you set a div to width: 100% and add 20px of padding, your element will be wider than the screen, causing horizontal scrolling.
/* Actual total width = 300 + 40 + 10 = 350px */ CSS can seem intimidating at first, but with
Start Writing CSS with Confidence (Module 1-3) - Kevin Powell
Apply display: flex to a container. Its direct children become “flex items” that can align, wrap, and grow.
: Relative to the font size of the root element ( ). By default, most browsers set 1rem to 16px . The selector targets the HTML element(s) you want
Don't worry if you've made these common mistakes – we've got solutions:
If you find that setting width or margin-top isn’t working on a span , check the display property. Changing it to display: inline-block or display: block instantly solves the issue.
The transparent space directly around the content, inside the border. Border: The line wrapped around the padding and content.
<main class="cards-grid"> <article class="card"> <img src="image.jpg" alt="" class="card__image"> <h3 class="card__title">Title</h3> <p class="card__description">Short description...</p> <a href="#" class="card__button">Read more</a> </article> <!-- repeat cards --> </main>