SlideShare uma empresa Scribd logo
1 de 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)

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Bootstrap
BootstrapBootstrap
Bootstrap
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
 
Css3
Css3Css3
Css3
 
javaScript.ppt
javaScript.pptjavaScript.ppt
javaScript.ppt
 
Javascript Basics
Javascript BasicsJavascript Basics
Javascript Basics
 
JavaScript Data Types
JavaScript Data TypesJavaScript Data Types
JavaScript Data Types
 
Introduction to xhtml
Introduction to xhtmlIntroduction to xhtml
Introduction to xhtml
 
Css
CssCss
Css
 
Introduction to CSS3
Introduction to CSS3Introduction to CSS3
Introduction to CSS3
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
 
Javascript 101
Javascript 101Javascript 101
Javascript 101
 
Javascript operators
Javascript operatorsJavascript operators
Javascript operators
 
New Elements & Features in CSS3
New Elements & Features in CSS3New Elements & Features in CSS3
New Elements & Features in CSS3
 
html-css
html-csshtml-css
html-css
 
CSS
CSSCSS
CSS
 
Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to Javascript
 
Css ppt
Css pptCss ppt
Css ppt
 
Java data types, variables and jvm
Java data types, variables and jvm Java data types, variables and jvm
Java data types, variables and jvm
 
JavaScript guide 2020 Learn JavaScript
JavaScript guide 2020 Learn JavaScriptJavaScript guide 2020 Learn JavaScript
JavaScript guide 2020 Learn JavaScript
 
CSS Transitions, Transforms, Animations
CSS Transitions, Transforms, Animations CSS Transitions, Transforms, Animations
CSS Transitions, Transforms, Animations
 

Destaque

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
 

Destaque (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)
 

Semelhante a 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
 

Mais de 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
 

Mais de 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)
 

Último

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 

Último (20)

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 

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; }