CSS : (Cascading style sheet) USing css we apply styles in HTML. only CSS useful for applying syles in HTML. CSS code we always embedded in HTML. Advantage of CSS: ---------------------------- --code reusability --css saves our time --Easy to maintain the code --css javscript,vbscript ,Angular, React(Compatability) --Using CSS we apply mutiple properties(background, text, border, image) syntax Of CSS: ---------------- selector{property: value} h1{color:red} ---declaration--- OR selector{property1: value1,property2: value2,property3:value3.......} h1{color:red, size: 12px, background-color:red} h1 { color:red; background-color:yellow; } Selectors in CSS: ------------------------ selector it is one of the tag name or element for applying styles mainly 3 types of selectors 1. class selector 2. id selector 3. mutiple selector How we embedded css in html is we use one of the main tag i.e here style tag it has some ofthe attributes. that attribute is type 1. class Selectors: ------------------------- in css class selector follows with class attribute and there value. whenever we add styles in style tag, we should starts with '.' dot operator with attribute value.
Hello World
Hello World
Welcome to javascript program
group selector =================================================== Add all tag in single then we apply styles known as group selectorWelcome to javascript program
CSS comments: ------------------------------------------ comments simply ignored by interpreter html, css, javscript the code which is executed by " interpreter "" c, c++ the program 'compiler' commenents are not executed by the interpreter. /* comment code */Welcome to javascript program
Where we include the css : -------------------------------------- if u want to include the css code in html then u follows the following ways. There are 3 ways to incllude css code in html 1. external style sheet 2. Internal style sheet(Embedded style sheet) 3. inline style sheet 1. External style sheet: --------------------------------------- With an external style sheet you can change the look of an entire website by using just one file. External style sheet we include from outside of the html programm. We save the external style sheet prrogram as with .css extension. and that should be included in html file by using one of the tag i.e first.html -----------------------------------Welcome to javascript program
mystyle.css: ========================== h1 { color:red; text-align:left; } h2 { color:blue; text-align: center; } p { color:yellow; text-align: right; } 2. Internal style sheet or Embedded style sheet: ------------------------------------------------------------- Internal style mean adding styles in Head section in html is known as Internal style sheet.Welcome to javascript program
3. Inline style sheet: ----------------------------------------- Inline style may be used to apply a unique style for a single element.Welcome to javascript program
CSS- Background: ------------------------------------------------------ The CSS background properties are used to define the background effects for elements. background-color background-image background-repeat background-position 1. background-color: The background-color property specified the background-color of an element. Example: body { background-color: red; }Welcome to javascript program
Example2: -------------- in the below example program image file repeated in y dimension similerly we change the value as repeat-x dimesnion or repeatWelcome to javascript program
CSS Border Properties: ------------------------------ In css the following are the border properties . They are 1. dotted 2.dashed 3. solid 4. double 5.groove....Welcome to Border properties
Welcome to Border properties
Welcome to Border properties
Welcome to Border properties
Welcome to Border properties
Welcome to Border properties
example2:Welcome to Border properties
Welcome to Border properties
Welcome to Border properties
Welcome to Border properties
CSS Margins: ---------------------- The Css margin prooperties are used to create space around elements outside of any defined borders. margin-top margin-right margin-bottom margin-leftCSS Margins: ---------------------- The Css margin prooperties are used to create space around elements outside of any defined borders. margin-top margin-right margin-bottom margin-left
CSS Padding: ------------------------------------------------ providing space around the element padding-top padding-bottom padding-left padding-rightCSS Margins: ---------------------- The Css margin prooperties are used to create space around elements outside of any defined borders. margin-top margin-right margin-bottom margin-left
CSS Margins: ---------------------- The Css margin prooperties are used to create space around elements outside of any defined borders. margin-top margin-right margin-bottom margin-leftCSS text properties: ---------------------------