Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have permission to ask a question, You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please type your username.

Please type your E-Mail.

Please choose an appropriate title for the post.

Please choose the appropriate section so your post can be easily searched.

Please choose suitable Keywords Ex: post, video.

Browse

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Navigation

  • Home
  • About Us
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Contact Us
Home/ Questions/Q 3382

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Latest Questions

Author
  • 61k
Author
Asked: November 26, 20242024-11-26T02:12:08+00:00 2024-11-26T02:12:08+00:00

(Part 2)Some Basics of CSS that you should have a look at.

  • 61k

In this post, I will be summarising some basics of CSS, which, you need to know if you are diving into Front-end development.

This part will be covering:

  • The CSS Box Model
  • Media Queries
  • CSS Animations and Keyframes

The Box Model

For CSS, every HTML element is a box.CSS determines the size, position, and properties (color, background, border size, etc.) of these boxes.

It can be best understood with the following image.

Box Model Description
Every box is composed of four parts (or areas), defined by their respective edges: the content edge, padding edge, border edge, and margin edge.

  • Padding – Clears an area around the content. The padding is transparent.
  • Margin – Clears an area outside the border. The margin is also transparent.

Positioning

  • Block Elements – those which usually start from a new line. Example: headings, paragraphs, divs, etc.
  • Inline Elements – are those which sits with the surrounding element. For example: images, spans etc.

The default layout of elements as per their type as listed above is called the Normal Flow of a document
We have position property of CSS to override the Normal flow.
This pairs with the CSS offset properties (left,right,top,bottom) to set how many pixels(or any other unit) away the element has to be positioned from where it is in the Normal Flow.
It accepts the following values.

  • position:relative
  • position:absolute
  • position:fixed

Read More about positioning.

Border

The following properties is used for providing border to an element.

  • border-weight – The thickness of border
  • border-style – solid, dotted, double, grove etc.
  • border-color – Provide the colour, or the default color black is applied. And you can use border shorthand property to set all above values directly as shown below.
.class{     width:100px;     height:100px;     border:10px solid #FA1298; } 
Enter fullscreen mode Exit fullscreen mode

Tip

Set box-sizing to border-box, this makes styling easier.

Quoting from MDN
border-box tells the browser to account for any border and padding in the values you specify for an element's width and height. If you set an element's width to 100 pixels, that 100 pixels will include any border or padding you added, and the content box will shrink to absorb that extra width. This typically makes it much easier to size elements.

Media Queries

They help you make your site responsive to different screen size.
The @media can be used to apply part of a style sheet based on the result of one or more media queries. With it, you specify a media query and a block of CSS to apply to the document if and only if the media query matches the device on which the content is being used.

(Think it like an if-statement, where the conditions are based on viewport sizes.)

Example:

@media screen and (min-width: 900px) {   div {     width:100px;   } } 
Enter fullscreen mode Exit fullscreen mode

More Details Here.

CSS Animations and Keyframes

In order to animate an element, you need to add the Animation properties in its styling.
The actual appearance of the animation is defined by the @keyframe rule.

  • animation-name gives the name of the keyframe rule. animation-iteraton-count – use infinite for endless animation.
  • animation-timing-function This can be linear, ease, cubic-bezier() etc. Read More about all possible values here.

Example:

Want to connect?

Connect with me here.

beginnerscssprogrammingwebdev
  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question

Stats

  • Questions 4k
  • Answers 0
  • Best Answers 0
  • Users 2k
  • Popular
  • Answers
  • Author

    ES6 - A beginners guide - Template Literals

    • 0 Answers
  • Author

    Understanding Higher Order Functions in JavaScript.

    • 0 Answers
  • Author

    Build a custom video chat app with Daily and Vue.js

    • 0 Answers

Top Members

Samantha Carter

Samantha Carter

  • 0 Questions
  • 20 Points
Begginer
Ella Lewis

Ella Lewis

  • 0 Questions
  • 20 Points
Begginer
Isaac Anderson

Isaac Anderson

  • 0 Questions
  • 20 Points
Begginer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore, ask, and connect. Join our vibrant Q&A community today!

About Us

  • About Us
  • Contact Us
  • All Users

Legal Stuff

  • Terms of Use
  • Privacy Policy
  • Cookie Policy

Help

  • Knowledge Base
  • Support

Follow

© 2022 Querify Question. All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.