1) What Is CSS?: Backward Skip 10splay Videoforward Skip 10S O O O O O
1) What Is CSS?: Backward Skip 10splay Videoforward Skip 10S O O O O O
CSS stands for Cascading Style Sheet. It is a popular styling language which is used
with HTML to design websites. It can also be used with any XML documents
including plain XML, SVG, and XUL.More details...
o CSS1
o CSS2
o CSS2.1
o CSS3
o CSS4
More details...
o Bandwidth
o Site-wide consistency
o Page reformatting
o Accessibility
o Content separated from presentation
o Bootstrap
o Foundation
o Semantic UI
o Gumby
o Ulkit
<style>
body {
background-color: linen;
}
h1 {
color: red;
margin-left: 80px;
}
</style>
o You can create classes for use on multiple tag types in the document.
o You can use selector and grouping methods to apply styles in complex
situations.
o No extra download is required to import the information.
o Selector
o Property
o Value
1. <style>
2. img.trans {
3. opacity: 0.4;
4. filter: alpha(opacity=40); /* For IE8 and earlier */
5. }
6. </style>
1. <style>
2. * {
3. color: green;
4. font-size: 20px;
5. }
6. </style>
7.
15) Which command is used for the selection of all the
elements of a paragraph?
The p[lang] command is used for selecting all the elements of a paragraph.
1. <style>
2. h2,p{
3. background-color: #b0d4de;
4. }
5. </style>
6.
1. <style>
2. body {
3. background-image: url("paper1.gif");
4. margin-left:100px;
5. }
6. </style>
7.
19) Name the property for controlling the image position in
the background.
The background-position property is used to define the initial position of the
background image. By default, the background image is placed on the top-left of the
webpage.
1. center
2. top
3. bottom
4. left
5. right
20) Name the property for controlling the image scroll in the
background.
The background-attachment property is used to specify if the background image is
fixed or scroll with the rest of the page in the browser window. If you set fixed the
background image, then the image not move during scrolling in the browser. Let's
take an example with the fixed background image.
1. <style>
2. .center {
3. text-align: center;
4. color: blue;
5. }
6. </style>
7.
CSS Id Selector
1. <style>
2. #para1 {
3. text-align: center;
4. color: blue;
5. }
6. </style>
7.
More details...
More details...
Syntax
Embedded: Embedded style sheets are put between the <head>...</head> tags.
Syntax
1. <style>
2. body {
3. background-color: linen;
4. }
5. h1 {
6. color: red;
7. margin-left: 80px;
8. }
9. </style>
10.
External: This is used to apply the style to all the pages within your website by
changing just one style sheet.
Syntax
1. <head>
2. <link rel="stylesheet" type="text/css" href="mystyle.css">
3. </head>
4.
o Physical tags are referred to as presentational markup while logical tags are
useless for appearances.
o Physical tags are newer versions, on the other hand, logical tags are old and
concentrate on content.
28) What is the CSS Box model and what are its elements?
The CSS box model is used to define the design and layout of elements of CSS.
The elements are:
To understand its purpose and origin, let's take a look at its print display. In the print
display, an image is set into the page such that text wraps around it as needed.
The closest option is to use the 'initial' property value, which restores the default CSS
values, rather than the browser's default styles.
An element with a higher z-index is always stacked above than a lower index.
1. <!DOCTYPE html>
2. <html>
3. <head>
4. <style>
5. h1.vis {
6. visibility: visible;
7. }
8.
9. h1.hid {
10. visibility: hidden;
11. }
12. </style>
13. </head>
14. <body>
15. <h1 class="vis">It is visible</h1>
16. <h1 class="hid">It is hidden</h1>
17.
18. <p>Note - Second heading is hidden, but it still occupy space.</p>
19. </body>
20. </html>
21.
display: none also hides the element but not occupy space. It will not affect the
layout of the document.
1. <!DOCTYPE html>
2. <html>
3. <head>
4. <style>
5. h1.vis {
6. display: block;
7. }
8.
9. h1.hid {
10. display: none;
11. }
12. </style>
13. </head>
14. <body>
15. <h1 class="vis">It is visible</h1>
16. <h1 class="hid">It is hidden</h1>
17.
18. <p>Note - Second heading is hidden and not occupy space.</p>
19. </body>
20. </html>
21.
It gives the impression that the first image has smoothly evolved into the second one.
In CSS3, Transforms (matrix, translate, rotate, scale) module can be used to achieve
tweening.
Apart from that, CSS3 contains new General Sibling Combinators which is
responsible for matching the sibling elements with the given elements.