際際滷

際際滷Share a Scribd company logo
1
Hands on
ADVANCED
CASCADING
STYLE SHEETS
(CSS)
2
ID & CLASS SELECTORS
 ID Selector:
 The id selector is used to specify a style for a single, unique element.
 The id selector uses the id attribute of the HTML element, and is defined
with a "#".
 The style rule below will be applied to the element with id="para1":
 Class Selector:
 The class selector is used to specify a style for a group of elements. Unlike
the id selector, the class selector is most often used on several elements.
 This allows you to set a particular style for many HTML elements with the
same class.
 The class selector uses the HTML class attribute, and is defined with a dot
"."
.center {text-align:center;}
It will be used as..
p.center {text-
align:center;}
3
 Example:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#para1
{
text-align:center;
color:red;
}
</style>
</head>
<body>
<p id="para1">Hello World!</p>
<p>This paragraph is not affected by the style.</p>
</body>
</html>
4
GROUPING SELECTORS
 In style sheets there are often elements with the same style. To avod
the code repeating, we can group them.
 Here is an example to change the size of an image using CSS.
CSS DIMENSIONS
img.normal
{ height:auto; }
img.big { height:40%; }
img.small { height:10%; }
<body>
<img class="normal" src=/slideshow/lecture-5-6-advance-css-pptx-for-web/275557020/"logocss.gif" width="95" height="84"
/><br />
<img class="big" src=/slideshow/lecture-5-6-advance-css-pptx-for-web/275557020/"logocss.gif" width="95" height="84"
/><br />
<img class="small" src=/slideshow/lecture-5-6-advance-css-pptx-for-web/275557020/"logocss.gif" width="95" height="84" />
</body>
CSS
code
using
classes
5
CSS DISPLAY AND VISIBILITY
 The display property specifies if/how an element is displayed. (none,
block)
Hiding an element can be done by setting the display property to "none"
 The visibility property specifies if an element should be visible or
hidden.
Hiding of an element can also be done by setting visibility property to
"hidden"
 Syntax:
6
CSS FLOAT
 With CSS float, an element can be pushed to the left or right, allowing
other elements to wrap around it.
 Float is very often used for images, but it is also useful when working
with layouts.
 Elements are floated horizontally, this means that an element can
only be floated left or right, not up or down.
 If an image is floated to the right, a following text flows around it, to
the left
 Here is example code to float multiple images on a web page.
<style
type="text/css">
.thumbnail
{
float:left;
width:110px;
height:90px;
margin:5px;
}
</style>
<body>
<h3>Image Gallery</h3>
<img class="thumbnail" src=/slideshow/lecture-5-6-advance-css-pptx-for-web/275557020/"klematis_small.jpg" width="107"
height="90">
<img class="thumbnail" src="klematis2_small.jpg" width="107"
height="80">
<img class="thumbnail" src="klematis3_small.jpg" width="116"
height="90">
<img class="thumbnail" src="klematis4_small.jpg" width="120"
height="90">
<img class="thumbnail" src=/slideshow/lecture-5-6-advance-css-pptx-for-web/275557020/"klematis_small.jpg" width="107"
height="90">
7
POSITIONING ELEMENTS
 The CSS positioning properties allow you to position an element.
 It can also place an element behind another, and specify what should
happen when an element's content is too big.
 Elements can be positioned using the top, bottom, left, and right
properties.
 However, these properties will not work unless the position property is
set first.
They also work differently depending on the positioning method.
 There are four different positioning methods.
 Static Positioning:
HTML elements are positioned static by default.
A static positioned element is always positioned according to the normal flow of
the page.
Static positioned elements are not affected by the top, bottom, left, and right
properties.
 Fixed Positioning
An element with fixed position is positioned relative to the browser window.
It will not move even if the window is scrolled.
Fixed positioned elements can overlap other elements.
8
 Relative Positioning
A relative positioned element is positioned relative to its normal position.
The content of relatively positioned elements can be moved and overlap
other elements,
but the reserved space for the element is still preserved in the normal flow.
Relatively positioned elements are often used as container blocks for
absolutely positioned elements.
 Absolute Positioning
An absolute position element is positioned relative to the first parent
element that has a position other than static. If no such element is found, the
containing block is <html>:
Absolutely positioned elements are removed from the normal flow. The
document and other elements behave like the absolutely positioned element
does not exist.
Asma Sajid ; College of Computer Science & Information Studies, GCUF 9
All CSS Positioning Properties
10
ADDING EFFECTS TO IMAGES (1)
 Transparent Image Effect
 The CSS3 property for transparency is opacity.
 We can set value for opacity.
 The opacity property can take a value from 0.0 - 1.0. A lower value
makes the element more transparent.
IE9, Firefox, Chrome, Opera, and Safari use the property opacity for
transparency.
 IE8 and earlier use filter:alpha(opacity=x).
The x can take a value from 0 - 100. A lower value makes the element more
transparent.
11
ADDING EFFECTS TO IMAGES (2)
 Hover Image Effect
 The first CSS block will be similar to the code in transparency example.
 In addition, we need to added what should happen when a user hover
over one of the images.
 In this case we want the image to NOT be transparent when the user
hover over it.
 The CSS for this is: opacity=1. And IE8 and earlier:
filter:alpha(opacity=100).
When the mouse pointer moves away from the image, the image will be
transparent again.
 Syntax:
12
CREATING IMAGE SPRITES
 Image Sprites
 An image sprite is a collection of images put into a single image.
 A web page with many images can take a long time to load and generates multiple
server requests.
 Using image sprites will reduce the number of server requests and save bandwidth.
 Instead of using three separate images, we use single image. (a.jpg)
 following example the CSS specifies which part of the a.jpg" image to show:
 SYNTAX:
 <img class="home" src=/slideshow/lecture-5-6-advance-css-pptx-for-web/275557020/"img_trans.gif" /> - Only defines a small transparent image because the
src attribute cannot be empty. The displayed image will be the background image we specify in
CSS.
 width:46px;height:44px; - Defines the portion of the image we want to use
 background:url(/slideshow/lecture-5-6-advance-css-pptx-for-web/275557020/img_navsprites.gif) 0 0; - Defines the background image and its position (left
0px, top 0px)
13
EXAMPLE- STRIPES
 Navigation List
 We will use an HTML list, because it can be a link and also supports a
background image.
 Explanation;
#navlist{position:relative;} - position is set to relative to allow absolute positioning
inside it
#navlist li{margin:0;padding:0;list-style:none;position:absolute;top:0;} - margin and
padding is set to 0, list-style is removed, and all list items are absolute positioned.
#navlist li, #navlist a{height:44px;display:block;} - the height of all the images are
44px
14
 Positioning
 Now start to position and style for each specific part:
#home{left:0px;width:46px;} - Positioned all the way to the left, and
the width of the image is 46px
#home{background:url(/slideshow/lecture-5-6-advance-css-pptx-for-web/275557020/img_navsprites.gif) 0 0;} - Defines the
background image and its position (left 0px, top 0px)
#prev{left:63px;width:43px;} - Positioned 63px to the right (#home
width 46px + some extra space between items), and the width is
43px.
#prev{background:url('/slideshow/lecture-5-6-advance-css-pptx-for-web/275557020/img_navsprites.gif') -47px 0;} - Defines the
background image 47px to the right (#home width 46px + 1px line
divider)
#next{left:129px;width:43px;}- Positioned 129px to the right (start
of #prev is 63px + #prev width 43px + extra space), and the width is
43px.
#next{background:url('/slideshow/lecture-5-6-advance-css-pptx-for-web/275557020/img_navsprites.gif') no-repeat -91px 0;} -
Defines the background image 91px to the right (#home width 46px
+ 1px line divider + #prev width 43px + 1px line divider )
15
 Adding Hover Effect.. ?
 We only add three lines of code to add the hover effect:
Explanation
 Since the list item contains a link, we can use the :hover pseudo-class
 #home a:hover{background: transparent
url(img_navsprites_hover.gif) 0 -45px;}
For all three hover images we specify the same background position, only
45px further down

More Related Content

Similar to Lecture 5 & 6 Advance CSS.pptx for web (20)

Organize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS TricksOrganize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS Tricks
Andolasoft Inc
Css advanced session 4
Css advanced  session 4Css advanced  session 4
Css advanced session 4
Dr. Ramkumar Lakshminarayanan
Lecture-8.pptx
Lecture-8.pptxLecture-8.pptx
Lecture-8.pptx
vishal choudhary
Web Layout
Web LayoutWeb Layout
Web Layout
Shawn Calvert
CSS for basic learner
CSS for basic learnerCSS for basic learner
CSS for basic learner
Yoeung Vibol
Designing for the web - 101
Designing for the web - 101Designing for the web - 101
Designing for the web - 101
Ashraf Hamdy
CSS3 PPT.pptx
CSS3 PPT.pptxCSS3 PPT.pptx
CSS3 PPT.pptx
AchieversIT
CSS3 basics for beginners - Imrokraft
CSS3 basics for beginners - ImrokraftCSS3 basics for beginners - Imrokraft
CSS3 basics for beginners - Imrokraft
imrokraft
CSS and CSS3
CSS and CSS3CSS and CSS3
CSS and CSS3
Robyn Overstreet
CSS Introduction
CSS Introduction CSS Introduction
CSS Introduction
Thapar Institute
CSS Walktrough Internship Course
CSS Walktrough Internship CourseCSS Walktrough Internship Course
CSS Walktrough Internship Course
Zoltan Iszlai
CSS_Day_Three (W3schools)
CSS_Day_Three (W3schools)CSS_Day_Three (W3schools)
CSS_Day_Three (W3schools)
Rafi Haidari
10 CSS Tricks and Tips to Create Astounding Websites
10 CSS Tricks and Tips to Create Astounding Websites10 CSS Tricks and Tips to Create Astounding Websites
10 CSS Tricks and Tips to Create Astounding Websites
Syntactics Inc.
HTML CSS & Javascript
HTML CSS & JavascriptHTML CSS & Javascript
HTML CSS & Javascript
David Lindkvist
Cascading Style sheet by Vishal Gour Guest Faculty CSE AUS
Cascading Style sheet by Vishal Gour Guest Faculty  CSE AUSCascading Style sheet by Vishal Gour Guest Faculty  CSE AUS
Cascading Style sheet by Vishal Gour Guest Faculty CSE AUS
ervishalgour
Css methods architecture
Css methods architectureCss methods architecture
Css methods architecture
Lasha Sumbadze
CSS
CSSCSS
CSS
Md. Sirajus Salayhin
Layouts Part 2
Layouts Part 2Layouts Part 2
Layouts Part 2
kjkleindorfer
Basic css
Basic cssBasic css
Basic css
Gopinath Ambothi
ADF - Layout Managers and Skinning
ADF - Layout Managers and SkinningADF - Layout Managers and Skinning
ADF - Layout Managers and Skinning
George Estebe
Organize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS TricksOrganize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS Tricks
Andolasoft Inc
CSS for basic learner
CSS for basic learnerCSS for basic learner
CSS for basic learner
Yoeung Vibol
Designing for the web - 101
Designing for the web - 101Designing for the web - 101
Designing for the web - 101
Ashraf Hamdy
CSS3 basics for beginners - Imrokraft
CSS3 basics for beginners - ImrokraftCSS3 basics for beginners - Imrokraft
CSS3 basics for beginners - Imrokraft
imrokraft
CSS Walktrough Internship Course
CSS Walktrough Internship CourseCSS Walktrough Internship Course
CSS Walktrough Internship Course
Zoltan Iszlai
CSS_Day_Three (W3schools)
CSS_Day_Three (W3schools)CSS_Day_Three (W3schools)
CSS_Day_Three (W3schools)
Rafi Haidari
10 CSS Tricks and Tips to Create Astounding Websites
10 CSS Tricks and Tips to Create Astounding Websites10 CSS Tricks and Tips to Create Astounding Websites
10 CSS Tricks and Tips to Create Astounding Websites
Syntactics Inc.
HTML CSS & Javascript
HTML CSS & JavascriptHTML CSS & Javascript
HTML CSS & Javascript
David Lindkvist
Cascading Style sheet by Vishal Gour Guest Faculty CSE AUS
Cascading Style sheet by Vishal Gour Guest Faculty  CSE AUSCascading Style sheet by Vishal Gour Guest Faculty  CSE AUS
Cascading Style sheet by Vishal Gour Guest Faculty CSE AUS
ervishalgour
Css methods architecture
Css methods architectureCss methods architecture
Css methods architecture
Lasha Sumbadze
ADF - Layout Managers and Skinning
ADF - Layout Managers and SkinningADF - Layout Managers and Skinning
ADF - Layout Managers and Skinning
George Estebe

More from ZahraWaheed9 (15)

PHP-04-Forms PHP-04-Forms PHP-04-Forms PHP-04-Forms
PHP-04-Forms PHP-04-Forms PHP-04-Forms PHP-04-FormsPHP-04-Forms PHP-04-Forms PHP-04-Forms PHP-04-Forms
PHP-04-Forms PHP-04-Forms PHP-04-Forms PHP-04-Forms
ZahraWaheed9
Chapter 5 SE Chapter 5 SE.pptChapter 5 SE.ppt
Chapter 5 SE Chapter 5 SE.pptChapter 5 SE.pptChapter 5 SE Chapter 5 SE.pptChapter 5 SE.ppt
Chapter 5 SE Chapter 5 SE.pptChapter 5 SE.ppt
ZahraWaheed9
Ch 14_Web Mining.pptxCh 14_Web Mining.pptx
Ch 14_Web Mining.pptxCh 14_Web Mining.pptxCh 14_Web Mining.pptxCh 14_Web Mining.pptx
Ch 14_Web Mining.pptxCh 14_Web Mining.pptx
ZahraWaheed9
Open URL in Chrome Browser from Python.pptx
Open URL in Chrome Browser from Python.pptxOpen URL in Chrome Browser from Python.pptx
Open URL in Chrome Browser from Python.pptx
ZahraWaheed9
php introduction to the basic student web
php introduction to the basic student webphp introduction to the basic student web
php introduction to the basic student web
ZahraWaheed9
ch 3 of C# programming in advanced programming
ch 3 of C# programming in advanced programmingch 3 of C# programming in advanced programming
ch 3 of C# programming in advanced programming
ZahraWaheed9
Responsive Web Designing for web development
Responsive Web Designing for web developmentResponsive Web Designing for web development
Responsive Web Designing for web development
ZahraWaheed9
Color Theory for web development class for students to understand good websites
Color Theory for web development class for students to understand good websitesColor Theory for web development class for students to understand good websites
Color Theory for web development class for students to understand good websites
ZahraWaheed9
C# wrokig based topics for students in advanced programming
C# wrokig based topics for students in advanced programmingC# wrokig based topics for students in advanced programming
C# wrokig based topics for students in advanced programming
ZahraWaheed9
CSharp POWERPOINT SLIDES C# VISUAL PROGRAMMING
CSharp POWERPOINT SLIDES C# VISUAL PROGRAMMINGCSharp POWERPOINT SLIDES C# VISUAL PROGRAMMING
CSharp POWERPOINT SLIDES C# VISUAL PROGRAMMING
ZahraWaheed9
visual programming GDI presentation powerpoint
visual programming GDI presentation powerpointvisual programming GDI presentation powerpoint
visual programming GDI presentation powerpoint
ZahraWaheed9
Visual programming Chapter 3: GUI (Graphical User Interface)
Visual programmingChapter 3: GUI (Graphical User Interface)Visual programmingChapter 3: GUI (Graphical User Interface)
Visual programming Chapter 3: GUI (Graphical User Interface)
ZahraWaheed9
Review Presentation on develeopment of automated quality
Review Presentation on develeopment of automated qualityReview Presentation on develeopment of automated quality
Review Presentation on develeopment of automated quality
ZahraWaheed9
Cross-Modal Scene Understanding presntation
Cross-Modal Scene Understanding presntationCross-Modal Scene Understanding presntation
Cross-Modal Scene Understanding presntation
ZahraWaheed9
Web Minnig and text mining presentation
Web Minnig and  text mining presentationWeb Minnig and  text mining presentation
Web Minnig and text mining presentation
ZahraWaheed9
PHP-04-Forms PHP-04-Forms PHP-04-Forms PHP-04-Forms
PHP-04-Forms PHP-04-Forms PHP-04-Forms PHP-04-FormsPHP-04-Forms PHP-04-Forms PHP-04-Forms PHP-04-Forms
PHP-04-Forms PHP-04-Forms PHP-04-Forms PHP-04-Forms
ZahraWaheed9
Chapter 5 SE Chapter 5 SE.pptChapter 5 SE.ppt
Chapter 5 SE Chapter 5 SE.pptChapter 5 SE.pptChapter 5 SE Chapter 5 SE.pptChapter 5 SE.ppt
Chapter 5 SE Chapter 5 SE.pptChapter 5 SE.ppt
ZahraWaheed9
Ch 14_Web Mining.pptxCh 14_Web Mining.pptx
Ch 14_Web Mining.pptxCh 14_Web Mining.pptxCh 14_Web Mining.pptxCh 14_Web Mining.pptx
Ch 14_Web Mining.pptxCh 14_Web Mining.pptx
ZahraWaheed9
Open URL in Chrome Browser from Python.pptx
Open URL in Chrome Browser from Python.pptxOpen URL in Chrome Browser from Python.pptx
Open URL in Chrome Browser from Python.pptx
ZahraWaheed9
php introduction to the basic student web
php introduction to the basic student webphp introduction to the basic student web
php introduction to the basic student web
ZahraWaheed9
ch 3 of C# programming in advanced programming
ch 3 of C# programming in advanced programmingch 3 of C# programming in advanced programming
ch 3 of C# programming in advanced programming
ZahraWaheed9
Responsive Web Designing for web development
Responsive Web Designing for web developmentResponsive Web Designing for web development
Responsive Web Designing for web development
ZahraWaheed9
Color Theory for web development class for students to understand good websites
Color Theory for web development class for students to understand good websitesColor Theory for web development class for students to understand good websites
Color Theory for web development class for students to understand good websites
ZahraWaheed9
C# wrokig based topics for students in advanced programming
C# wrokig based topics for students in advanced programmingC# wrokig based topics for students in advanced programming
C# wrokig based topics for students in advanced programming
ZahraWaheed9
CSharp POWERPOINT SLIDES C# VISUAL PROGRAMMING
CSharp POWERPOINT SLIDES C# VISUAL PROGRAMMINGCSharp POWERPOINT SLIDES C# VISUAL PROGRAMMING
CSharp POWERPOINT SLIDES C# VISUAL PROGRAMMING
ZahraWaheed9
visual programming GDI presentation powerpoint
visual programming GDI presentation powerpointvisual programming GDI presentation powerpoint
visual programming GDI presentation powerpoint
ZahraWaheed9
Visual programming Chapter 3: GUI (Graphical User Interface)
Visual programmingChapter 3: GUI (Graphical User Interface)Visual programmingChapter 3: GUI (Graphical User Interface)
Visual programming Chapter 3: GUI (Graphical User Interface)
ZahraWaheed9
Review Presentation on develeopment of automated quality
Review Presentation on develeopment of automated qualityReview Presentation on develeopment of automated quality
Review Presentation on develeopment of automated quality
ZahraWaheed9
Cross-Modal Scene Understanding presntation
Cross-Modal Scene Understanding presntationCross-Modal Scene Understanding presntation
Cross-Modal Scene Understanding presntation
ZahraWaheed9
Web Minnig and text mining presentation
Web Minnig and  text mining presentationWeb Minnig and  text mining presentation
Web Minnig and text mining presentation
ZahraWaheed9

Recently uploaded (20)

Purchase Analysis in Odoo 17 - Odoo 際際滷s
Purchase Analysis in Odoo 17 - Odoo 際際滷sPurchase Analysis in Odoo 17 - Odoo 際際滷s
Purchase Analysis in Odoo 17 - Odoo 際際滷s
Celine George
How to process Interwarehouse and Intrawarehouse transfers in Odoo
How to process Interwarehouse and Intrawarehouse transfers in OdooHow to process Interwarehouse and Intrawarehouse transfers in Odoo
How to process Interwarehouse and Intrawarehouse transfers in Odoo
Celine George
Using GenAI for Universal Design for Learning
Using GenAI for Universal Design for LearningUsing GenAI for Universal Design for Learning
Using GenAI for Universal Design for Learning
Damian T. Gordon
NC Advisory Council on Student Safety and Well-Being
NC Advisory Council on Student Safety and Well-BeingNC Advisory Council on Student Safety and Well-Being
NC Advisory Council on Student Safety and Well-Being
Mebane Rash
Unit No 4- Chemotherapy of Malignancy.pptx
Unit No  4- Chemotherapy of Malignancy.pptxUnit No  4- Chemotherapy of Malignancy.pptx
Unit No 4- Chemotherapy of Malignancy.pptx
Ashish Umale
Strategic Corporate Social Responsibility: Sustainable Value Creation Fourth
Strategic Corporate Social Responsibility: Sustainable Value Creation FourthStrategic Corporate Social Responsibility: Sustainable Value Creation Fourth
Strategic Corporate Social Responsibility: Sustainable Value Creation Fourth
keileyrazawi
Synthesis for VIth SEM 21-2-25.pptx by Mrs. Manjushri P. Dabhade
Synthesis for VIth SEM 21-2-25.pptx by Mrs. Manjushri P. DabhadeSynthesis for VIth SEM 21-2-25.pptx by Mrs. Manjushri P. Dabhade
Synthesis for VIth SEM 21-2-25.pptx by Mrs. Manjushri P. Dabhade
Dabhade madam Dabhade
PUBH1000 際際滷s - Module 7: Ecological Health
PUBH1000 際際滷s - Module 7: Ecological HealthPUBH1000 際際滷s - Module 7: Ecological Health
PUBH1000 際際滷s - Module 7: Ecological Health
Jonathan Hallett
PATENTABILITY UNDER THE 2025 CRI DRAFT GUIDELINES
PATENTABILITY UNDER THE 2025 CRI DRAFT GUIDELINESPATENTABILITY UNDER THE 2025 CRI DRAFT GUIDELINES
PATENTABILITY UNDER THE 2025 CRI DRAFT GUIDELINES
BananaIP Counsels
Combinatorial_Chemistry.pptx by Mrs. Manjushri P. Dabhade
Combinatorial_Chemistry.pptx by Mrs. Manjushri P. DabhadeCombinatorial_Chemistry.pptx by Mrs. Manjushri P. Dabhade
Combinatorial_Chemistry.pptx by Mrs. Manjushri P. Dabhade
Dabhade madam Dabhade
PSD-I Exam Dumps: Your Key to Passing on the First Try
PSD-I Exam Dumps: Your Key to Passing on the First TryPSD-I Exam Dumps: Your Key to Passing on the First Try
PSD-I Exam Dumps: Your Key to Passing on the First Try
lethamcmullen
Unit No. 4 - Immunopharmacologyslides.pptx
Unit No. 4 - Immunopharmacologyslides.pptxUnit No. 4 - Immunopharmacologyslides.pptx
Unit No. 4 - Immunopharmacologyslides.pptx
Ashish Umale
technology in banking ppt FOR E-CONTENT -2.ppt
technology in banking ppt  FOR E-CONTENT -2.ppttechnology in banking ppt  FOR E-CONTENT -2.ppt
technology in banking ppt FOR E-CONTENT -2.ppt
HARIHARAN A
Developing Topic and Research Question for Systematic Reviews - Emmanuel Ekpor
Developing Topic and Research Question for Systematic Reviews - Emmanuel EkporDeveloping Topic and Research Question for Systematic Reviews - Emmanuel Ekpor
Developing Topic and Research Question for Systematic Reviews - Emmanuel Ekpor
Systematic Reviews Network (SRN)
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-6-2025 ver 5.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-6-2025 ver 5.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 4-6-2025 ver 5.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-6-2025 ver 5.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
APM London Network: Essentials of a Good PMO, 2 April 2025
APM London Network: Essentials of a Good PMO, 2 April 2025APM London Network: Essentials of a Good PMO, 2 April 2025
APM London Network: Essentials of a Good PMO, 2 April 2025
Association for Project Management
All India Council of Skills and Vocational Studies (AICSVS) PROSPECTUS 2025
All India Council of Skills and Vocational Studies (AICSVS) PROSPECTUS 2025All India Council of Skills and Vocational Studies (AICSVS) PROSPECTUS 2025
All India Council of Skills and Vocational Studies (AICSVS) PROSPECTUS 2025
National Council of Open Schooling Research and Training
How to manage Customer Tips with Odoo 17 Point Of Sale
How to manage Customer Tips with Odoo 17 Point Of SaleHow to manage Customer Tips with Odoo 17 Point Of Sale
How to manage Customer Tips with Odoo 17 Point Of Sale
Celine George
IB-Unit-4 BBA BVIMR 2022 Syllabus_watermark.pdf
IB-Unit-4 BBA BVIMR 2022 Syllabus_watermark.pdfIB-Unit-4 BBA BVIMR 2022 Syllabus_watermark.pdf
IB-Unit-4 BBA BVIMR 2022 Syllabus_watermark.pdf
Dr. Mahtab Alam
Proteins, Bio similars & Antibodies.pptx
Proteins, Bio similars &  Antibodies.pptxProteins, Bio similars &  Antibodies.pptx
Proteins, Bio similars & Antibodies.pptx
Ashish Umale
Purchase Analysis in Odoo 17 - Odoo 際際滷s
Purchase Analysis in Odoo 17 - Odoo 際際滷sPurchase Analysis in Odoo 17 - Odoo 際際滷s
Purchase Analysis in Odoo 17 - Odoo 際際滷s
Celine George
How to process Interwarehouse and Intrawarehouse transfers in Odoo
How to process Interwarehouse and Intrawarehouse transfers in OdooHow to process Interwarehouse and Intrawarehouse transfers in Odoo
How to process Interwarehouse and Intrawarehouse transfers in Odoo
Celine George
Using GenAI for Universal Design for Learning
Using GenAI for Universal Design for LearningUsing GenAI for Universal Design for Learning
Using GenAI for Universal Design for Learning
Damian T. Gordon
NC Advisory Council on Student Safety and Well-Being
NC Advisory Council on Student Safety and Well-BeingNC Advisory Council on Student Safety and Well-Being
NC Advisory Council on Student Safety and Well-Being
Mebane Rash
Unit No 4- Chemotherapy of Malignancy.pptx
Unit No  4- Chemotherapy of Malignancy.pptxUnit No  4- Chemotherapy of Malignancy.pptx
Unit No 4- Chemotherapy of Malignancy.pptx
Ashish Umale
Strategic Corporate Social Responsibility: Sustainable Value Creation Fourth
Strategic Corporate Social Responsibility: Sustainable Value Creation FourthStrategic Corporate Social Responsibility: Sustainable Value Creation Fourth
Strategic Corporate Social Responsibility: Sustainable Value Creation Fourth
keileyrazawi
Synthesis for VIth SEM 21-2-25.pptx by Mrs. Manjushri P. Dabhade
Synthesis for VIth SEM 21-2-25.pptx by Mrs. Manjushri P. DabhadeSynthesis for VIth SEM 21-2-25.pptx by Mrs. Manjushri P. Dabhade
Synthesis for VIth SEM 21-2-25.pptx by Mrs. Manjushri P. Dabhade
Dabhade madam Dabhade
PUBH1000 際際滷s - Module 7: Ecological Health
PUBH1000 際際滷s - Module 7: Ecological HealthPUBH1000 際際滷s - Module 7: Ecological Health
PUBH1000 際際滷s - Module 7: Ecological Health
Jonathan Hallett
PATENTABILITY UNDER THE 2025 CRI DRAFT GUIDELINES
PATENTABILITY UNDER THE 2025 CRI DRAFT GUIDELINESPATENTABILITY UNDER THE 2025 CRI DRAFT GUIDELINES
PATENTABILITY UNDER THE 2025 CRI DRAFT GUIDELINES
BananaIP Counsels
Combinatorial_Chemistry.pptx by Mrs. Manjushri P. Dabhade
Combinatorial_Chemistry.pptx by Mrs. Manjushri P. DabhadeCombinatorial_Chemistry.pptx by Mrs. Manjushri P. Dabhade
Combinatorial_Chemistry.pptx by Mrs. Manjushri P. Dabhade
Dabhade madam Dabhade
PSD-I Exam Dumps: Your Key to Passing on the First Try
PSD-I Exam Dumps: Your Key to Passing on the First TryPSD-I Exam Dumps: Your Key to Passing on the First Try
PSD-I Exam Dumps: Your Key to Passing on the First Try
lethamcmullen
Unit No. 4 - Immunopharmacologyslides.pptx
Unit No. 4 - Immunopharmacologyslides.pptxUnit No. 4 - Immunopharmacologyslides.pptx
Unit No. 4 - Immunopharmacologyslides.pptx
Ashish Umale
technology in banking ppt FOR E-CONTENT -2.ppt
technology in banking ppt  FOR E-CONTENT -2.ppttechnology in banking ppt  FOR E-CONTENT -2.ppt
technology in banking ppt FOR E-CONTENT -2.ppt
HARIHARAN A
Developing Topic and Research Question for Systematic Reviews - Emmanuel Ekpor
Developing Topic and Research Question for Systematic Reviews - Emmanuel EkporDeveloping Topic and Research Question for Systematic Reviews - Emmanuel Ekpor
Developing Topic and Research Question for Systematic Reviews - Emmanuel Ekpor
Systematic Reviews Network (SRN)
How to manage Customer Tips with Odoo 17 Point Of Sale
How to manage Customer Tips with Odoo 17 Point Of SaleHow to manage Customer Tips with Odoo 17 Point Of Sale
How to manage Customer Tips with Odoo 17 Point Of Sale
Celine George
IB-Unit-4 BBA BVIMR 2022 Syllabus_watermark.pdf
IB-Unit-4 BBA BVIMR 2022 Syllabus_watermark.pdfIB-Unit-4 BBA BVIMR 2022 Syllabus_watermark.pdf
IB-Unit-4 BBA BVIMR 2022 Syllabus_watermark.pdf
Dr. Mahtab Alam
Proteins, Bio similars & Antibodies.pptx
Proteins, Bio similars &  Antibodies.pptxProteins, Bio similars &  Antibodies.pptx
Proteins, Bio similars & Antibodies.pptx
Ashish Umale

Lecture 5 & 6 Advance CSS.pptx for web

  • 2. 2 ID & CLASS SELECTORS ID Selector: The id selector is used to specify a style for a single, unique element. The id selector uses the id attribute of the HTML element, and is defined with a "#". The style rule below will be applied to the element with id="para1": Class Selector: The class selector is used to specify a style for a group of elements. Unlike the id selector, the class selector is most often used on several elements. This allows you to set a particular style for many HTML elements with the same class. The class selector uses the HTML class attribute, and is defined with a dot "." .center {text-align:center;} It will be used as.. p.center {text- align:center;}
  • 3. 3 Example: <!DOCTYPE html> <html> <head> <style type="text/css"> #para1 { text-align:center; color:red; } </style> </head> <body> <p id="para1">Hello World!</p> <p>This paragraph is not affected by the style.</p> </body> </html>
  • 4. 4 GROUPING SELECTORS In style sheets there are often elements with the same style. To avod the code repeating, we can group them. Here is an example to change the size of an image using CSS. CSS DIMENSIONS img.normal { height:auto; } img.big { height:40%; } img.small { height:10%; } <body> <img class="normal" src=/slideshow/lecture-5-6-advance-css-pptx-for-web/275557020/"logocss.gif" width="95" height="84" /><br /> <img class="big" src=/slideshow/lecture-5-6-advance-css-pptx-for-web/275557020/"logocss.gif" width="95" height="84" /><br /> <img class="small" src=/slideshow/lecture-5-6-advance-css-pptx-for-web/275557020/"logocss.gif" width="95" height="84" /> </body> CSS code using classes
  • 5. 5 CSS DISPLAY AND VISIBILITY The display property specifies if/how an element is displayed. (none, block) Hiding an element can be done by setting the display property to "none" The visibility property specifies if an element should be visible or hidden. Hiding of an element can also be done by setting visibility property to "hidden" Syntax:
  • 6. 6 CSS FLOAT With CSS float, an element can be pushed to the left or right, allowing other elements to wrap around it. Float is very often used for images, but it is also useful when working with layouts. Elements are floated horizontally, this means that an element can only be floated left or right, not up or down. If an image is floated to the right, a following text flows around it, to the left Here is example code to float multiple images on a web page. <style type="text/css"> .thumbnail { float:left; width:110px; height:90px; margin:5px; } </style> <body> <h3>Image Gallery</h3> <img class="thumbnail" src=/slideshow/lecture-5-6-advance-css-pptx-for-web/275557020/"klematis_small.jpg" width="107" height="90"> <img class="thumbnail" src="klematis2_small.jpg" width="107" height="80"> <img class="thumbnail" src="klematis3_small.jpg" width="116" height="90"> <img class="thumbnail" src="klematis4_small.jpg" width="120" height="90"> <img class="thumbnail" src=/slideshow/lecture-5-6-advance-css-pptx-for-web/275557020/"klematis_small.jpg" width="107" height="90">
  • 7. 7 POSITIONING ELEMENTS The CSS positioning properties allow you to position an element. It can also place an element behind another, and specify what should happen when an element's content is too big. Elements can be positioned using the top, bottom, left, and right properties. However, these properties will not work unless the position property is set first. They also work differently depending on the positioning method. There are four different positioning methods. Static Positioning: HTML elements are positioned static by default. A static positioned element is always positioned according to the normal flow of the page. Static positioned elements are not affected by the top, bottom, left, and right properties. Fixed Positioning An element with fixed position is positioned relative to the browser window. It will not move even if the window is scrolled. Fixed positioned elements can overlap other elements.
  • 8. 8 Relative Positioning A relative positioned element is positioned relative to its normal position. The content of relatively positioned elements can be moved and overlap other elements, but the reserved space for the element is still preserved in the normal flow. Relatively positioned elements are often used as container blocks for absolutely positioned elements. Absolute Positioning An absolute position element is positioned relative to the first parent element that has a position other than static. If no such element is found, the containing block is <html>: Absolutely positioned elements are removed from the normal flow. The document and other elements behave like the absolutely positioned element does not exist.
  • 9. Asma Sajid ; College of Computer Science & Information Studies, GCUF 9 All CSS Positioning Properties
  • 10. 10 ADDING EFFECTS TO IMAGES (1) Transparent Image Effect The CSS3 property for transparency is opacity. We can set value for opacity. The opacity property can take a value from 0.0 - 1.0. A lower value makes the element more transparent. IE9, Firefox, Chrome, Opera, and Safari use the property opacity for transparency. IE8 and earlier use filter:alpha(opacity=x). The x can take a value from 0 - 100. A lower value makes the element more transparent.
  • 11. 11 ADDING EFFECTS TO IMAGES (2) Hover Image Effect The first CSS block will be similar to the code in transparency example. In addition, we need to added what should happen when a user hover over one of the images. In this case we want the image to NOT be transparent when the user hover over it. The CSS for this is: opacity=1. And IE8 and earlier: filter:alpha(opacity=100). When the mouse pointer moves away from the image, the image will be transparent again. Syntax:
  • 12. 12 CREATING IMAGE SPRITES Image Sprites An image sprite is a collection of images put into a single image. A web page with many images can take a long time to load and generates multiple server requests. Using image sprites will reduce the number of server requests and save bandwidth. Instead of using three separate images, we use single image. (a.jpg) following example the CSS specifies which part of the a.jpg" image to show: SYNTAX: <img class="home" src=/slideshow/lecture-5-6-advance-css-pptx-for-web/275557020/"img_trans.gif" /> - Only defines a small transparent image because the src attribute cannot be empty. The displayed image will be the background image we specify in CSS. width:46px;height:44px; - Defines the portion of the image we want to use background:url(/slideshow/lecture-5-6-advance-css-pptx-for-web/275557020/img_navsprites.gif) 0 0; - Defines the background image and its position (left 0px, top 0px)
  • 13. 13 EXAMPLE- STRIPES Navigation List We will use an HTML list, because it can be a link and also supports a background image. Explanation; #navlist{position:relative;} - position is set to relative to allow absolute positioning inside it #navlist li{margin:0;padding:0;list-style:none;position:absolute;top:0;} - margin and padding is set to 0, list-style is removed, and all list items are absolute positioned. #navlist li, #navlist a{height:44px;display:block;} - the height of all the images are 44px
  • 14. 14 Positioning Now start to position and style for each specific part: #home{left:0px;width:46px;} - Positioned all the way to the left, and the width of the image is 46px #home{background:url(/slideshow/lecture-5-6-advance-css-pptx-for-web/275557020/img_navsprites.gif) 0 0;} - Defines the background image and its position (left 0px, top 0px) #prev{left:63px;width:43px;} - Positioned 63px to the right (#home width 46px + some extra space between items), and the width is 43px. #prev{background:url('/slideshow/lecture-5-6-advance-css-pptx-for-web/275557020/img_navsprites.gif') -47px 0;} - Defines the background image 47px to the right (#home width 46px + 1px line divider) #next{left:129px;width:43px;}- Positioned 129px to the right (start of #prev is 63px + #prev width 43px + extra space), and the width is 43px. #next{background:url('/slideshow/lecture-5-6-advance-css-pptx-for-web/275557020/img_navsprites.gif') no-repeat -91px 0;} - Defines the background image 91px to the right (#home width 46px + 1px line divider + #prev width 43px + 1px line divider )
  • 15. 15 Adding Hover Effect.. ? We only add three lines of code to add the hover effect: Explanation Since the list item contains a link, we can use the :hover pseudo-class #home a:hover{background: transparent url(img_navsprites_hover.gif) 0 -45px;} For all three hover images we specify the same background position, only 45px further down