CSS Flashcards
Abreaviation of CSS ?
Cascading Style Sheets
How to define css inside an html document ?
style element is used
<style> body { background-color : green ; } </style>
How to import css file in HTML Document ?
We have to use link element to link external file to HTML document.
< link href=”stylesheet” rel=”stylesheet” />
What is the general structure of css block in HTML Document ?
We have to use style element ?
<style> HTML Element Selecter { css Property Name : value ; } </style>
What is the relation between parent element with Heading element regarding font size ?
Font size of heading element is pre defined, inheritance is not work in heading element.
How to select text color of a class ?
Basic Structure is :-
.className {
css-property-name : value
}
.first {
color:red;
}
How to select by id ?
Basic Structure is :-
#id-name { css-property-name :value; } #your-name { background-color: red; }
What is Short Hand property in CSS ?
Short Hand property of CSS means defining multiple values with one property .
Example-:
border : 5px solid #444
/*Here we have three values,border thickness, border style, & border color */
Border propertyt is not inherited.
How to reset all property of all elements in HTML Document?
We have to use Star selector of CSS.
- {
margin:0;
padding:0;
box-sizing: border-box;
}
How to reset all CSS porperties of HTML Document ?
We have to use star selecter in CSS.
- {
margin:0;
padding:0;
box-sizing: border-box;
}
What is Box Model ?
According to the box model,each and every element on a webpage can be seen as a rectangular box and each box, can have a width,a height, padding, margins and a border.
What is Content in Box ?
Contents are images ,text & any other information we want to publish .
What is Padding in Box ?
Padding is the transparent area around the content inside the box.
Padding means white-spaces, or spaces between contents inside the box
What is Margin int the Box ?
Margin means spaces between boxes , they are white-spaces which are outside of the Box , in HTML Document.
What is Border in Box Model
Border is the outside line of the box which goes around the padding and the content.
What is the Difference Between inline Elements & Block Elements ?
Block Elements create their own Line, but inline elements occupies the space as text they have
Basic rule to add CSS to HTML ?
HTML Documents made up of Elements,thus CSS is applied to elements.
We have two methods to apply CSS :-
- Inside the HTML Document
- By importing CSS file in HTML doc.
Basic rule is select a element,class or id & apply CCS property to it.
How to add CSS to multiple elements together ?
The method is , Specify multiple elements using list separator under curly braces give CSS property & its value.Now property is applied to both elements simultaneously
How to apply CSS to an image ?
The best practice to style an image is , first add an identifier to image , beacuse we have multiple images in an HTML Document, by using identifier we can style multiple images indvidually.
How to fix aspect ratio of an image ?
We have to use aspect ratio property of CSS.
aspect-ratio: auto