SlideShare a Scribd company logo
1 of 14
www.afghanhost.af - info@afghanhost.af
Instructor: Mohammad Rafi Haidari31-May-2014
CSS (Day 3)
 Margin
 Padding
 Positioning
 Float
 Navigation Bar
 Opacity / Transparency
CSS Margin
The margin clears an area around an element (outside the border). The margin does
not have a background color, and is completely transparent.
The top, right, bottom, and left margin can be changed independently using separate
properties. A shorthand margin property can also be used, to change all margins at
once.
Margin - Individual sides
In CSS, it is possible to specify different margins for different sides:
margin-top:100px;
margin-bottom:100px;
margin-right:50px;
margin-left:50px;
CSS Padding
The padding clears an area around the content (inside the border) of an element. The
padding is affected by the background color of the element.
The top, right, bottom, and left padding can be changed independently using
separate properties. A shorthand padding property can also be used, to change all
paddings at once.
Padding - Individual sides
In CSS, it is possible to specify different padding for different sides:
padding-top:25px;
padding-bottom:25px;
padding-right:50px;
padding-left:50px;
CSS Positioning
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.
o Static Positioning
o Fixed Positioning
o Relative Positioning
o Absolute Positioning
CSS Positioning
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:
p.pos_fixed
{
position:fixed;
top:30px;
right:5px;
}
CSS Positioning
Relative Positioning
A relative positioned element is positioned relative to its normal position.
h2.pos_left
{
position:relative;
left:-20px;
}
h2.pos_right
{
position:relative;
left:20px;
}
CSS Positioning
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>:
h2{
position:absolute;
left:100px;
top:150px;
}
Overlapping Elements
When elements are positioned outside the normal flow, they can overlap other
elements.
The z-index property specifies the stack order of an element (which element should
be placed in front of, or behind, the others).
z-index:-1;
CSS Float
Elements are floated horizontally, this means that an element can only be floated left
or right, not up or down.
A floated element will move as far to the left or right as it can. Usually this means all
the way to the left or right of the containing element.
The elements after the floating element will flow around it.
The elements before the floating element will not be affected.
If an image is floated to the right, a following text flows around it, to the left:
img
{
float:right;
}
CSS Float
Floating Elements Next to Each Other
If you place several floating elements after each other, they will float next to each
other if there is room.
Here we have made an image gallery using the float property:
.thumbnail {
float:left;
width:110px;
height:90px;
margin:5px;
}
Turning off Float
Elements after the floating element will flow around it. To avoid this, use the clear
property.
.text_line{clear:both;}
CSS Navigation Bar
Having easy-to-use navigation is important for any web site.
With CSS you can transform boring HTML menus into good-looking navigation bars.
Navigation Bar = List of Links
A navigation bar needs standard HTML as a base.
In our examples we will build the navigation bar from a standard HTML list.
A navigation bar is basically a list of links, so using the <ul> and <li> elements
makes perfect sense:
<ul>
<li><a href="home.php">Home</a></li>
<li><a href="contact.php">Contact</a></li>
<li><a href="about.php">About</a></li>
</ul>
CSS Navigation Bar
Now let's remove the bullets and the margins and padding from the list:
ul{
list-style-type:none;
margin:0;
padding:0;}
Floating List Items
In the example above the links have different widths.
For all the links to have an equal width, float the <li> elements and specify a width
for the <a> elements:
li{float:left;}
a{
display:block;
width:60px;
}
CSS Image Opacity / Transparency
Creating transparent images with CSS is easy.
The CSS opacity property is a part of the W3C CSS3 recommendation.
The CSS3 property for transparency is opacity.
Img
{
opacity:0.4;
}
Mouse over the images:
img:hover
{
opacity:1.0;
}
CSS Image Opacity / Transparency
Creating transparent images with CSS is easy.
The CSS opacity property is a part of the W3C CSS3 recommendation.
The CSS3 property for transparency is opacity.
Img
{
opacity:0.4;
}
Mouse over the images:
img:hover
{
opacity:1.0;
}
CSS_Day_Three (W3schools)

More Related Content

What's hot (20)

Manet
ManetManet
Manet
 
JavaScript Basics And DOM Manipulation
JavaScript Basics And DOM ManipulationJavaScript Basics And DOM Manipulation
JavaScript Basics And DOM Manipulation
 
html-css
html-csshtml-css
html-css
 
Html training slide
Html training slideHtml training slide
Html training slide
 
CSS for Beginners
CSS for BeginnersCSS for Beginners
CSS for Beginners
 
Wan technologies
Wan technologiesWan technologies
Wan technologies
 
Css Basics
Css BasicsCss Basics
Css Basics
 
HTML Block and Inline Elements
HTML Block and Inline ElementsHTML Block and Inline Elements
HTML Block and Inline Elements
 
Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)
 
Java script ppt
Java script pptJava script ppt
Java script ppt
 
Html ppt
Html pptHtml ppt
Html ppt
 
Css position
Css positionCss position
Css position
 
Dns server
Dns serverDns server
Dns server
 
Bootstrap Part - 1
Bootstrap Part - 1Bootstrap Part - 1
Bootstrap Part - 1
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
Mongodb
MongodbMongodb
Mongodb
 
Css selectors
Css selectorsCss selectors
Css selectors
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Introduction to HTML+CSS+Javascript.pptx
Introduction to HTML+CSS+Javascript.pptxIntroduction to HTML+CSS+Javascript.pptx
Introduction to HTML+CSS+Javascript.pptx
 
Local area network
Local area networkLocal area network
Local area network
 

Viewers also liked

CSS_Day_Two (W3schools)
CSS_Day_Two (W3schools)CSS_Day_Two (W3schools)
CSS_Day_Two (W3schools)Rafi Haidari
 
CSS_Day_ONE (W3schools)
CSS_Day_ONE (W3schools)CSS_Day_ONE (W3schools)
CSS_Day_ONE (W3schools)Rafi Haidari
 
Pets of the olympic games (1)
Pets of the olympic games (1)Pets of the olympic games (1)
Pets of the olympic games (1)anagarridoaroz99
 
opentext-digital-world-infographic-en
opentext-digital-world-infographic-enopentext-digital-world-infographic-en
opentext-digital-world-infographic-enMichaelVanPamelen1
 
Захисник України: бібліографічний список літератури
Захисник України: бібліографічний список літературиЗахисник України: бібліографічний список літератури
Захисник України: бібліографічний список літературиРОМЦ БКР
 
ალბერ კამიუ სიზიფის მითი
ალბერ კამიუ   სიზიფის მითიალბერ კამიუ   სიზიფის მითი
ალბერ კამიუ სიზიფის მითიNini Sekhniashvili
 
7วิชาสามัญ ฟิสิกส์ + เฉลย
7วิชาสามัญ ฟิสิกส์ + เฉลย7วิชาสามัญ ฟิสิกส์ + เฉลย
7วิชาสามัญ ฟิสิกส์ + เฉลยsarwsw
 
Historia juegos olimpicos59
Historia juegos olimpicos59Historia juegos olimpicos59
Historia juegos olimpicos59anagarridoaroz99
 
Records of the olympic field games (6)
Records of the olympic field games (6)Records of the olympic field games (6)
Records of the olympic field games (6)anagarridoaroz99
 
Html_Day_One (W3Schools)
Html_Day_One (W3Schools)Html_Day_One (W3Schools)
Html_Day_One (W3Schools)Rafi Haidari
 

Viewers also liked (14)

CSS_Day_Two (W3schools)
CSS_Day_Two (W3schools)CSS_Day_Two (W3schools)
CSS_Day_Two (W3schools)
 
CSS_Day_ONE (W3schools)
CSS_Day_ONE (W3schools)CSS_Day_ONE (W3schools)
CSS_Day_ONE (W3schools)
 
Pets of the olympic games (1)
Pets of the olympic games (1)Pets of the olympic games (1)
Pets of the olympic games (1)
 
opentext-digital-world-infographic-en
opentext-digital-world-infographic-enopentext-digital-world-infographic-en
opentext-digital-world-infographic-en
 
Bootstrap day1
Bootstrap day1Bootstrap day1
Bootstrap day1
 
Захисник України: бібліографічний список літератури
Захисник України: бібліографічний список літературиЗахисник України: бібліографічний список літератури
Захисник України: бібліографічний список літератури
 
Onet eng
Onet engOnet eng
Onet eng
 
ალბერ კამიუ სიზიფის მითი
ალბერ კამიუ   სიზიფის მითიალბერ კამიუ   სიზიფის მითი
ალბერ კამიუ სიზიფის მითი
 
Naaijer familiedag 2014
Naaijer familiedag 2014Naaijer familiedag 2014
Naaijer familiedag 2014
 
7วิชาสามัญ ฟิสิกส์ + เฉลย
7วิชาสามัญ ฟิสิกส์ + เฉลย7วิชาสามัญ ฟิสิกส์ + เฉลย
7วิชาสามัญ ฟิสิกส์ + เฉลย
 
8 profession
8 profession8 profession
8 profession
 
Historia juegos olimpicos59
Historia juegos olimpicos59Historia juegos olimpicos59
Historia juegos olimpicos59
 
Records of the olympic field games (6)
Records of the olympic field games (6)Records of the olympic field games (6)
Records of the olympic field games (6)
 
Html_Day_One (W3Schools)
Html_Day_One (W3Schools)Html_Day_One (W3Schools)
Html_Day_One (W3Schools)
 

Similar to CSS_Day_Three (W3schools) (20)

Art of css
Art of cssArt of css
Art of css
 
CSS_Dibbo
CSS_DibboCSS_Dibbo
CSS_Dibbo
 
Css 101
Css 101Css 101
Css 101
 
Css advanced – session 4
Css advanced – session 4Css advanced – session 4
Css advanced – session 4
 
Lecture2 CSS 3
Lecture2   CSS 3Lecture2   CSS 3
Lecture2 CSS 3
 
Chapter6
Chapter6Chapter6
Chapter6
 
CSS
CSSCSS
CSS
 
Class 10
Class 10Class 10
Class 10
 
Web Layout
Web LayoutWeb Layout
Web Layout
 
Web Design Course: CSS lecture 4
Web Design Course: CSS  lecture 4Web Design Course: CSS  lecture 4
Web Design Course: CSS lecture 4
 
WDES106 CSS Advanced Part 1
WDES106 CSS Advanced Part 1WDES106 CSS Advanced Part 1
WDES106 CSS Advanced Part 1
 
Advanced CSS.pptx
Advanced CSS.pptxAdvanced CSS.pptx
Advanced CSS.pptx
 
CSS Walktrough Internship Course
CSS Walktrough Internship CourseCSS Walktrough Internship Course
CSS Walktrough Internship Course
 
Web Programming Basic topic.pptx
Web Programming Basic topic.pptxWeb Programming Basic topic.pptx
Web Programming Basic topic.pptx
 
CSS3 PPT.pptx
CSS3 PPT.pptxCSS3 PPT.pptx
CSS3 PPT.pptx
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
 
CSS Positioning and Features of CSS3
CSS Positioning and Features of CSS3CSS Positioning and Features of CSS3
CSS Positioning and Features of CSS3
 
CSS
CSSCSS
CSS
 
Lecture-8.pptx
Lecture-8.pptxLecture-8.pptx
Lecture-8.pptx
 
Page layout with css
Page layout with cssPage layout with css
Page layout with css
 

More from Rafi Haidari

Lecture9 web design and development
Lecture9 web design and developmentLecture9 web design and development
Lecture9 web design and developmentRafi Haidari
 
Lecture8 web design and development
Lecture8 web design and developmentLecture8 web design and development
Lecture8 web design and developmentRafi Haidari
 
Lecture7 web design and development
Lecture7 web design and developmentLecture7 web design and development
Lecture7 web design and developmentRafi Haidari
 
Lecture6 web design and development
Lecture6 web design and developmentLecture6 web design and development
Lecture6 web design and developmentRafi Haidari
 
Lecture5 web design and development
Lecture5 web design and developmentLecture5 web design and development
Lecture5 web design and developmentRafi Haidari
 
Lecture4 web design and development
Lecture4 web design and developmentLecture4 web design and development
Lecture4 web design and developmentRafi Haidari
 
Lecture3 web design and development
Lecture3 web design and developmentLecture3 web design and development
Lecture3 web design and developmentRafi Haidari
 
Lecture2 web design and development
Lecture2 web design and developmentLecture2 web design and development
Lecture2 web design and developmentRafi Haidari
 
Lecture1 Web Design and Development
Lecture1 Web Design and DevelopmentLecture1 Web Design and Development
Lecture1 Web Design and DevelopmentRafi Haidari
 
Html_Day_Three(W3Schools)
Html_Day_Three(W3Schools)Html_Day_Three(W3Schools)
Html_Day_Three(W3Schools)Rafi Haidari
 
HTML_Day_Two(W3Schools)
HTML_Day_Two(W3Schools)HTML_Day_Two(W3Schools)
HTML_Day_Two(W3Schools)Rafi Haidari
 

More from Rafi Haidari (13)

Lecture9 web design and development
Lecture9 web design and developmentLecture9 web design and development
Lecture9 web design and development
 
Lecture8 web design and development
Lecture8 web design and developmentLecture8 web design and development
Lecture8 web design and development
 
Lecture7 web design and development
Lecture7 web design and developmentLecture7 web design and development
Lecture7 web design and development
 
Lecture6 web design and development
Lecture6 web design and developmentLecture6 web design and development
Lecture6 web design and development
 
Lecture5 web design and development
Lecture5 web design and developmentLecture5 web design and development
Lecture5 web design and development
 
Lecture4 web design and development
Lecture4 web design and developmentLecture4 web design and development
Lecture4 web design and development
 
Lecture3 web design and development
Lecture3 web design and developmentLecture3 web design and development
Lecture3 web design and development
 
Lecture2 web design and development
Lecture2 web design and developmentLecture2 web design and development
Lecture2 web design and development
 
Lecture1 Web Design and Development
Lecture1 Web Design and DevelopmentLecture1 Web Design and Development
Lecture1 Web Design and Development
 
Bootstrap day3
Bootstrap day3Bootstrap day3
Bootstrap day3
 
Bootstrap day2
Bootstrap day2Bootstrap day2
Bootstrap day2
 
Html_Day_Three(W3Schools)
Html_Day_Three(W3Schools)Html_Day_Three(W3Schools)
Html_Day_Three(W3Schools)
 
HTML_Day_Two(W3Schools)
HTML_Day_Two(W3Schools)HTML_Day_Two(W3Schools)
HTML_Day_Two(W3Schools)
 

Recently uploaded

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 

Recently uploaded (20)

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 

CSS_Day_Three (W3schools)

  • 1. www.afghanhost.af - info@afghanhost.af Instructor: Mohammad Rafi Haidari31-May-2014 CSS (Day 3)  Margin  Padding  Positioning  Float  Navigation Bar  Opacity / Transparency
  • 2. CSS Margin The margin clears an area around an element (outside the border). The margin does not have a background color, and is completely transparent. The top, right, bottom, and left margin can be changed independently using separate properties. A shorthand margin property can also be used, to change all margins at once. Margin - Individual sides In CSS, it is possible to specify different margins for different sides: margin-top:100px; margin-bottom:100px; margin-right:50px; margin-left:50px;
  • 3. CSS Padding The padding clears an area around the content (inside the border) of an element. The padding is affected by the background color of the element. The top, right, bottom, and left padding can be changed independently using separate properties. A shorthand padding property can also be used, to change all paddings at once. Padding - Individual sides In CSS, it is possible to specify different padding for different sides: padding-top:25px; padding-bottom:25px; padding-right:50px; padding-left:50px;
  • 4. CSS Positioning 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. o Static Positioning o Fixed Positioning o Relative Positioning o Absolute Positioning
  • 5. CSS Positioning 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: p.pos_fixed { position:fixed; top:30px; right:5px; }
  • 6. CSS Positioning Relative Positioning A relative positioned element is positioned relative to its normal position. h2.pos_left { position:relative; left:-20px; } h2.pos_right { position:relative; left:20px; }
  • 7. CSS Positioning 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>: h2{ position:absolute; left:100px; top:150px; } Overlapping Elements When elements are positioned outside the normal flow, they can overlap other elements. The z-index property specifies the stack order of an element (which element should be placed in front of, or behind, the others). z-index:-1;
  • 8. CSS Float Elements are floated horizontally, this means that an element can only be floated left or right, not up or down. A floated element will move as far to the left or right as it can. Usually this means all the way to the left or right of the containing element. The elements after the floating element will flow around it. The elements before the floating element will not be affected. If an image is floated to the right, a following text flows around it, to the left: img { float:right; }
  • 9. CSS Float Floating Elements Next to Each Other If you place several floating elements after each other, they will float next to each other if there is room. Here we have made an image gallery using the float property: .thumbnail { float:left; width:110px; height:90px; margin:5px; } Turning off Float Elements after the floating element will flow around it. To avoid this, use the clear property. .text_line{clear:both;}
  • 10. CSS Navigation Bar Having easy-to-use navigation is important for any web site. With CSS you can transform boring HTML menus into good-looking navigation bars. Navigation Bar = List of Links A navigation bar needs standard HTML as a base. In our examples we will build the navigation bar from a standard HTML list. A navigation bar is basically a list of links, so using the <ul> and <li> elements makes perfect sense: <ul> <li><a href="home.php">Home</a></li> <li><a href="contact.php">Contact</a></li> <li><a href="about.php">About</a></li> </ul>
  • 11. CSS Navigation Bar Now let's remove the bullets and the margins and padding from the list: ul{ list-style-type:none; margin:0; padding:0;} Floating List Items In the example above the links have different widths. For all the links to have an equal width, float the <li> elements and specify a width for the <a> elements: li{float:left;} a{ display:block; width:60px; }
  • 12. CSS Image Opacity / Transparency Creating transparent images with CSS is easy. The CSS opacity property is a part of the W3C CSS3 recommendation. The CSS3 property for transparency is opacity. Img { opacity:0.4; } Mouse over the images: img:hover { opacity:1.0; }
  • 13. CSS Image Opacity / Transparency Creating transparent images with CSS is easy. The CSS opacity property is a part of the W3C CSS3 recommendation. The CSS3 property for transparency is opacity. Img { opacity:0.4; } Mouse over the images: img:hover { opacity:1.0; }