SlideShare a Scribd company logo
Web Programming and
Design
CSS (Cascading Style Sheet)
By : Gheyath M. Othman
CSS Margin
2
• The CSS margin properties define the space around elements.
• It 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. Like
margin: 25px 50px 75px 100px;
top right bottom left
margin: 25px 50px 75px;
top right+left bottom
margin: 25px 50px;
top+bottom right+left
margin: 25px;
top+bottom+right+left
You can also use it separately: LIKE
CSS Margin
3
All CSS margin properties:
Property Description
margin A shorthand property for setting the margin properties in one declaration
margin-bottom Sets the bottom margin of an element
margin-left Sets the left margin of an element
margin-right Sets the right margin of an element
margin-top Sets the top margin of an element
CSS Margin
4
Example-1- Margin: Margin
<!DOCTYPE html><html><head>
<style>
p.all {
margin: 5px;
}
p.ex {
margin: 100px 150px 100px 300px;
}
</style>
</head>
<body>
<p>This is a paragraph with no specified margins</p>
<p class="all">This is a paragraph with specified
margins.all in one</p>
<p class="ex">This is a paragraph with specified
margins.</p>
</body></html>
CSS Padding
5
• The CSS padding properties define the space between the element border and
the element content.
• Padding clears an area around the content (inside border) of 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. Like
padding: 25px 50px 75px;
top right+left bottom
padding: 25px;
top+bottom+right+left
Also you can use it separately. LIKE
CSS Padding
6
padding: 25px 50px;
top+bottom right+left
All CSS padding properties:
Property Description
padding A shorthand property for setting all the padding properties in one
declaration
padding-bottom Sets the bottom padding of an element
padding-left Sets the left padding of an element
padding-right Sets the right padding of an element
padding-top Sets the top padding of an element
padding: 25px 50px 75px 100px;
top right bottom left
CSS Padding
7
Example -1- :padding
<!DOCTYPE html><html><head>
<style>
p { background-color: yellow; }
p.all
{ padding: 25px; }
p.padding
{
padding: 25px 50px 75px 100px;
}
</style>
</head>
<body>
<p>This is a paragraph with no specified padding.</p>
<p class="all">This is a paragraph with specified
paddings.</p>
<p class="padding">This is a paragraph with specified
paddings.</p>
</body></html>
Bottom padding
Out_padd_border_margin
CSS Dimensions
8
All CSS Dimension properties:
The CSS dimension properties allow you to control the height and width of an
element.
Property Description
height Sets the height of an element
max-height Sets the maximum height of an element
max-width Sets the maximum width of an element
min-height Sets the minimum height of an element
min-width Sets the minimum width of an element
width Sets the width of an element
example_dimen2
CSS Dimensions
9
Example -1- :
<!DOCTYPE html><html><head>
<style>
div {
max-width: 500px;
height: 100px;
border: 3px solid #8AC007;
}
</style>
</head>
<body>
<div>
This div element has a height of 100px and a max-width
of 500px. This div element has a height of 100px and a
max-width of 500px. This div element has a height of
100px and a max-width of 500px. This div element has a
height of 100px and a max-width of 500px.
</div>
</body></html>
CSS Layout (overflow)
10
The overflow property specifies what to do if the content of an element exceeds
the size of the element's box. Syntax
overflow: auto, hidden, scroll
Example
11
e2_overflow
<!DOCTYPE html><html><head>
<style>
div.scroll { background-color: #00FFFF; width: 100px;
height: 100px; overflow: scroll; }
div.hidden { background-color: #00FF00; width: 100px;
height: 100px; overflow: hidden; }
div.auto { background-color: #00FF00; width: 100px;
height: 100px; overflow: auto; }
</style>
</head> <body>
<p>Result with overflow:scroll</p>
<div class="scroll">You can use the overflow property when you want
to have better control of the layout.</div>
<p>Result with overflow:hidden</p>
<div class="hidden">You can use the overflow property when you
want to have better control of the layout. The default value is
visible.</div>
<p>Result with overflow:auto</p>
<div class="auto">You can use the overflow property when you want
to have better control of the layout. The default value is visible.</div>
</body></html>
e2_overflow
CSS Layout (Float & Clear)
12
• The float property specifies whether or not an element should float.
• The float property can be used to wrap text around images.
Float property:
float: left, right, none
e1_float
CSS Layout (Float & Clear)
13
Example-1-: e1_float
<!DOCTYPE html><html><head>
<style>
img { float: right;
margin: 0 0 10px 10px; }
</style>
</head>
<body>
<p>The image will float to the right in the paragraph,
and the text in the paragraph will wrap around the image.
<img src="../smiley.gif" alt="smiley.com" width="100"
height="140">
In this example, the image will float to the right in the paragraph,
and the text in the paragraph will wrap around the image.In this
example, the image will float to the right in the paragraph, and
the text in the paragraph will wrap around the image.In this
example, the image will float to the right in the paragraph, and
the text in the paragraph will wrap around the image.In this
example, the image will float to the right in the paragraph, and
the text in the paragraph will wrap around the image.</p>
</body></html>
CSS Layout (Float & Clear)
14
• The clear property is used to control the behavior of floating elements.
• Elements after a floating element will flow around it. To avoid this, use the
clear property.
• The clear property specifies on which sides of an element floating elements
are not allowed to float.
Clear property:
clear: left, right, both, none
CSS Layout (Float & Clear)
15
Example-1-: e2_clear
<!DOCTYPE html><html><head>
<style>
.div1,.div3 { float: left; width: 100px;
height: 50px; margin: 10px;
border: 3px solid #8AC007; }
.div2 { border: 1px solid red; }
.div4 { border: 1px solid red; clear: left; }
</style>
</head><body>
<h2>Without clear</h2><div class="div1">div1</div>
<div class="div2">div2 - Notice that the div2 element is after div1,
in the HTML code. However, since div1 is floated to the left, this
happens: the text in div2 is floated around div1, and div2
surrounds the whole thing.</div>
<h2>Using clear</h2><div class="div3">div3</div>
<div class="div4">div4 - Using clear moves div4 down below the
floated div3. The value "left" clears elements floated to the left.
You can also clear "right" and "both".</div>
</body></html>
CSS Layout (Display Property)
16
• The display property is the most important CSS property for controlling
layout.
• The display property specifies if/how an element is displayed.
• Every HTML element has a default display value depending on what type
of element it is. The default display value for most elements
is block or inline.
CSS Layout (Display :inline-block)
17
• It has been possible for a long time to create a grid of boxes that fills the
browser width and wraps nicely (when the browser is resized), by using
the float property.
• However, the inline-block value of the display property makes this even
easier.
• inline-block elements are like inline elements but they can have a width and
a height.
• Example using float once and inline-block another, it has the same result.
.floating-box {
display: inline-block;
width: 150px;
height: 75px;
margin: 10px;
border: 3px solid #8AC007;}
.floating-box {
float: left;
width: 150px;
height: 75px;
margin: 10px;
border: 3px solid #8AC007;}
e4-e3_inline-block+float
CSS Layout (Display Property)
18
Div
Examples of block-level elements: <div>
<h1> - <h6>
<p>
A block-level element always starts on a new line and takes up the full width
available (stretches out to the left and right as far as it can).
Block-level Elements:
Inline Elements:
An inline element does not start on a new line and only takes up as much width
as necessary. This is a paragraph.an inline <span> element inside
Examples of Inline elements:
• <span>
• <a>
• <img>
Block-level & Inline Elements
19
Example:
<!DOCTYPE html><html><head>
<style>
.ul1 li{
display: inline;
}
.ul2 li{
display: block;
}
</style>
</head>
<body><p>Display a list of links as a horizontal menu:INLINE</p>
<ul class="ul1">
<li><a href="#home.html" >HTML</a></li>
<li><a href="#home.html" >CSS</a></li>
<li><a href="#home.html" >JavaScript</a></li></ul>
<p>Display a list of links as a vertical menu:BLOCK</p>
<ul class="ul2">
<li><a href="#home.html" >HTML</a></li>
<li><a href="#home.html" >CSS</a></li>
<li><a href="#home.html" >JavaScript</a></li>
</ul>
</body></html>
e1_Inline-block
CSS Layout (Display Property)
20
Hide an Element - display:none or visibility:hidden
• Hiding an element can be done by setting the display property to none. The
element will be hidden, and the page will be displayed as if the element is not
there. h1.hidden {
display: none;
}
h1.hidden {
visibility: hidden;
}
• visibility:hidden; also hides an element However, the element will still take up
the same space as before. The element will be hidden, but still affect the
layout.
Block-level & Inline Elements
21
Example:
<!DOCTYPE html><html><head>
<style>
h1.hidden {
display: none;
}
h2.hidden {
visibility: hidden;
}
</style>
</head>
<body>
<h1>This is a visible heading</h1>
<h1 class="hidden">This is a hidden heading</h1>
<p>Notice that the h1 element with display: none; does not take
up any space.</p>
<hr>
<h2>This is a visible heading</h1>
<h2 class="hidden">This is a hidden heading</h1>
<p>Notice that the h2 element with visibility hidden; take up a
space.</p>
</body></html>
display+visiblity
Doesn’t Take the space

More Related Content

What's hot

HTML 5 Simple Tutorial Part 1
HTML 5 Simple Tutorial Part 1HTML 5 Simple Tutorial Part 1
HTML 5 Simple Tutorial Part 1
Sanjeev Kumar
 
CSS ppt
CSS pptCSS ppt
CSS
CSSCSS
uptu web technology unit 2 Css
uptu web technology unit 2 Cssuptu web technology unit 2 Css
uptu web technology unit 2 Css
Abhishek Kesharwani
 
Intro to CSS
Intro to CSSIntro to CSS
Intro to CSS
Randy Oest II
 
TUTORIAL DE CSS 2.0
TUTORIAL DE CSS 2.0TUTORIAL DE CSS 2.0
TUTORIAL DE CSS 2.0
Vladimir Valencia
 
Css
CssCss
Css
CssCss
CSS Basics
CSS BasicsCSS Basics
CSS Basics
WordPress Memphis
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
Eliran Eliassy
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
Knoldus Inc.
 
Css Basics
Css BasicsCss Basics
Css Basics
Jay Patel
 
HTML, CSS And JAVASCRIPT!
HTML, CSS And JAVASCRIPT!HTML, CSS And JAVASCRIPT!
HTML, CSS And JAVASCRIPT!
Syahmi RH
 
Css Complete Notes
Css Complete NotesCss Complete Notes
Css Complete Notes
EPAM Systems
 
CSS for Beginners
CSS for BeginnersCSS for Beginners
CSS for Beginners
Amit Kumar Singh
 
Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01
Hatem Mahmoud
 
html-css
html-csshtml-css
Cascading Style Sheets - Part 02
Cascading Style Sheets - Part 02Cascading Style Sheets - Part 02
Cascading Style Sheets - Part 02
Hatem Mahmoud
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
Ferdous Mahmud Shaon
 
Introduction to Cascading Style Sheets
Introduction to Cascading Style SheetsIntroduction to Cascading Style Sheets
Introduction to Cascading Style Sheets
Tushar Joshi
 

What's hot (20)

HTML 5 Simple Tutorial Part 1
HTML 5 Simple Tutorial Part 1HTML 5 Simple Tutorial Part 1
HTML 5 Simple Tutorial Part 1
 
CSS ppt
CSS pptCSS ppt
CSS ppt
 
CSS
CSSCSS
CSS
 
uptu web technology unit 2 Css
uptu web technology unit 2 Cssuptu web technology unit 2 Css
uptu web technology unit 2 Css
 
Intro to CSS
Intro to CSSIntro to CSS
Intro to CSS
 
TUTORIAL DE CSS 2.0
TUTORIAL DE CSS 2.0TUTORIAL DE CSS 2.0
TUTORIAL DE CSS 2.0
 
Css
CssCss
Css
 
Css
CssCss
Css
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
 
Css Basics
Css BasicsCss Basics
Css Basics
 
HTML, CSS And JAVASCRIPT!
HTML, CSS And JAVASCRIPT!HTML, CSS And JAVASCRIPT!
HTML, CSS And JAVASCRIPT!
 
Css Complete Notes
Css Complete NotesCss Complete Notes
Css Complete Notes
 
CSS for Beginners
CSS for BeginnersCSS for Beginners
CSS for Beginners
 
Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01
 
html-css
html-csshtml-css
html-css
 
Cascading Style Sheets - Part 02
Cascading Style Sheets - Part 02Cascading Style Sheets - Part 02
Cascading Style Sheets - Part 02
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
Introduction to Cascading Style Sheets
Introduction to Cascading Style SheetsIntroduction to Cascading Style Sheets
Introduction to Cascading Style Sheets
 

Similar to Web Design Course: CSS lecture 4

CSS_Dibbo
CSS_DibboCSS_Dibbo
CSS_Dibbo
Sayanton Vhaduri
 
CSS Walktrough Internship Course
CSS Walktrough Internship CourseCSS Walktrough Internship Course
CSS Walktrough Internship Course
Zoltan Iszlai
 
GOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for thatGOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for that
Rachel Andrew
 
Web Layout
Web LayoutWeb Layout
Web Layout
Shawn Calvert
 
The Creative New World of CSS
The Creative New World of CSSThe Creative New World of CSS
The Creative New World of CSS
Rachel Andrew
 
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style Sheets
Senthil Kumar
 
HTML5 & CSS3 Flag
HTML5 & CSS3 FlagHTML5 & CSS3 Flag
HTML5 & CSS3 Flag
Christopher Schmitt
 
CSS tutorial chapter 3
CSS tutorial chapter 3CSS tutorial chapter 3
CSS tutorial chapter 3
jeweltutin
 
Quarter 3_Lesson_One_CSSheets_Paddings.pdf
Quarter 3_Lesson_One_CSSheets_Paddings.pdfQuarter 3_Lesson_One_CSSheets_Paddings.pdf
Quarter 3_Lesson_One_CSSheets_Paddings.pdf
RobilynBPataras
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Erin M. Kidwell
 
Lecture-8.pptx
Lecture-8.pptxLecture-8.pptx
Lecture-8.pptx
vishal choudhary
 
Css tips & tricks
Css tips & tricksCss tips & tricks
Css tips & tricks
anubavam-techkt
 
Html advance
Html advanceHtml advance
Html advance
PumoTechnovation
 
HTML-Advance.pptx
HTML-Advance.pptxHTML-Advance.pptx
HTML-Advance.pptx
Pandiya Rajan
 
Pfnp slides
Pfnp slidesPfnp slides
Pfnp slides
William Myers
 
Implementing Awesome: An HTML5/CSS3 Workshop
Implementing Awesome: An HTML5/CSS3 WorkshopImplementing Awesome: An HTML5/CSS3 Workshop
Implementing Awesome: An HTML5/CSS3 Workshop
Shoshi Roberts
 
An Event Apart Seattle - New CSS Layout Meets the Real World
An Event Apart Seattle - New CSS Layout Meets the Real WorldAn Event Apart Seattle - New CSS Layout Meets the Real World
An Event Apart Seattle - New CSS Layout Meets the Real World
Rachel Andrew
 
Css advanced – session 4
Css advanced – session 4Css advanced – session 4
Css advanced – session 4
Dr. Ramkumar Lakshminarayanan
 
CSS.pdf
CSS.pdfCSS.pdf
CSS.pdf
SoniaJoshi25
 
New CSS Meets the Real World
New CSS Meets the Real WorldNew CSS Meets the Real World
New CSS Meets the Real World
Rachel Andrew
 

Similar to Web Design Course: CSS lecture 4 (20)

CSS_Dibbo
CSS_DibboCSS_Dibbo
CSS_Dibbo
 
CSS Walktrough Internship Course
CSS Walktrough Internship CourseCSS Walktrough Internship Course
CSS Walktrough Internship Course
 
GOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for thatGOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for that
 
Web Layout
Web LayoutWeb Layout
Web Layout
 
The Creative New World of CSS
The Creative New World of CSSThe Creative New World of CSS
The Creative New World of CSS
 
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style Sheets
 
HTML5 & CSS3 Flag
HTML5 & CSS3 FlagHTML5 & CSS3 Flag
HTML5 & CSS3 Flag
 
CSS tutorial chapter 3
CSS tutorial chapter 3CSS tutorial chapter 3
CSS tutorial chapter 3
 
Quarter 3_Lesson_One_CSSheets_Paddings.pdf
Quarter 3_Lesson_One_CSSheets_Paddings.pdfQuarter 3_Lesson_One_CSSheets_Paddings.pdf
Quarter 3_Lesson_One_CSSheets_Paddings.pdf
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
 
Lecture-8.pptx
Lecture-8.pptxLecture-8.pptx
Lecture-8.pptx
 
Css tips & tricks
Css tips & tricksCss tips & tricks
Css tips & tricks
 
Html advance
Html advanceHtml advance
Html advance
 
HTML-Advance.pptx
HTML-Advance.pptxHTML-Advance.pptx
HTML-Advance.pptx
 
Pfnp slides
Pfnp slidesPfnp slides
Pfnp slides
 
Implementing Awesome: An HTML5/CSS3 Workshop
Implementing Awesome: An HTML5/CSS3 WorkshopImplementing Awesome: An HTML5/CSS3 Workshop
Implementing Awesome: An HTML5/CSS3 Workshop
 
An Event Apart Seattle - New CSS Layout Meets the Real World
An Event Apart Seattle - New CSS Layout Meets the Real WorldAn Event Apart Seattle - New CSS Layout Meets the Real World
An Event Apart Seattle - New CSS Layout Meets the Real World
 
Css advanced – session 4
Css advanced – session 4Css advanced – session 4
Css advanced – session 4
 
CSS.pdf
CSS.pdfCSS.pdf
CSS.pdf
 
New CSS Meets the Real World
New CSS Meets the Real WorldNew CSS Meets the Real World
New CSS Meets the Real World
 

Recently uploaded

一比一原版新西兰奥塔哥大学毕业证(otago毕业证)如何办理
一比一原版新西兰奥塔哥大学毕业证(otago毕业证)如何办理一比一原版新西兰奥塔哥大学毕业证(otago毕业证)如何办理
一比一原版新西兰奥塔哥大学毕业证(otago毕业证)如何办理
taqyea
 
Digital Marketing with a Focus on Sustainability
Digital Marketing with a Focus on SustainabilityDigital Marketing with a Focus on Sustainability
Digital Marketing with a Focus on Sustainability
sssourabhsharma
 
Dpboss Matka Guessing Satta Matta Matka Kalyan Chart Satta Matka
Dpboss Matka Guessing Satta Matta Matka Kalyan Chart Satta MatkaDpboss Matka Guessing Satta Matta Matka Kalyan Chart Satta Matka
Dpboss Matka Guessing Satta Matta Matka Kalyan Chart Satta Matka
➒➌➎➏➑➐➋➑➐➐Dpboss Matka Guessing Satta Matka Kalyan Chart Indian Matka
 
❼❷⓿❺❻❷❽❷❼❽ Dpboss Matka Result Satta Matka Guessing Satta Fix jodi Kalyan Fin...
❼❷⓿❺❻❷❽❷❼❽ Dpboss Matka Result Satta Matka Guessing Satta Fix jodi Kalyan Fin...❼❷⓿❺❻❷❽❷❼❽ Dpboss Matka Result Satta Matka Guessing Satta Fix jodi Kalyan Fin...
❼❷⓿❺❻❷❽❷❼❽ Dpboss Matka Result Satta Matka Guessing Satta Fix jodi Kalyan Fin...
❼❷⓿❺❻❷❽❷❼❽ Dpboss Kalyan Satta Matka Guessing Matka Result Main Bazar chart
 
Building Your Employer Brand with Social Media
Building Your Employer Brand with Social MediaBuilding Your Employer Brand with Social Media
Building Your Employer Brand with Social Media
LuanWise
 
Creative Web Design Company in Singapore
Creative Web Design Company in SingaporeCreative Web Design Company in Singapore
Creative Web Design Company in Singapore
techboxsqauremedia
 
How MJ Global Leads the Packaging Industry.pdf
How MJ Global Leads the Packaging Industry.pdfHow MJ Global Leads the Packaging Industry.pdf
How MJ Global Leads the Packaging Industry.pdf
MJ Global
 
Unveiling the Dynamic Personalities, Key Dates, and Horoscope Insights: Gemin...
Unveiling the Dynamic Personalities, Key Dates, and Horoscope Insights: Gemin...Unveiling the Dynamic Personalities, Key Dates, and Horoscope Insights: Gemin...
Unveiling the Dynamic Personalities, Key Dates, and Horoscope Insights: Gemin...
my Pandit
 
The 10 Most Influential Leaders Guiding Corporate Evolution, 2024.pdf
The 10 Most Influential Leaders Guiding Corporate Evolution, 2024.pdfThe 10 Most Influential Leaders Guiding Corporate Evolution, 2024.pdf
The 10 Most Influential Leaders Guiding Corporate Evolution, 2024.pdf
thesiliconleaders
 
Lundin Gold Corporate Presentation - June 2024
Lundin Gold Corporate Presentation - June 2024Lundin Gold Corporate Presentation - June 2024
Lundin Gold Corporate Presentation - June 2024
Adnet Communications
 
Zodiac Signs and Food Preferences_ What Your Sign Says About Your Taste
Zodiac Signs and Food Preferences_ What Your Sign Says About Your TasteZodiac Signs and Food Preferences_ What Your Sign Says About Your Taste
Zodiac Signs and Food Preferences_ What Your Sign Says About Your Taste
my Pandit
 
Digital Transformation Frameworks: Driving Digital Excellence
Digital Transformation Frameworks: Driving Digital ExcellenceDigital Transformation Frameworks: Driving Digital Excellence
Digital Transformation Frameworks: Driving Digital Excellence
Operational Excellence Consulting
 
Industrial Tech SW: Category Renewal and Creation
Industrial Tech SW:  Category Renewal and CreationIndustrial Tech SW:  Category Renewal and Creation
Industrial Tech SW: Category Renewal and Creation
Christian Dahlen
 
Satta Matka Dpboss Matka Guessing Kalyan Chart Indian Matka Kalyan panel Chart
Satta Matka Dpboss Matka Guessing Kalyan Chart Indian Matka Kalyan panel ChartSatta Matka Dpboss Matka Guessing Kalyan Chart Indian Matka Kalyan panel Chart
Satta Matka Dpboss Matka Guessing Kalyan Chart Indian Matka Kalyan panel Chart
➒➌➎➏➑➐➋➑➐➐Dpboss Matka Guessing Satta Matka Kalyan Chart Indian Matka
 
Observation Lab PowerPoint Assignment for TEM 431
Observation Lab PowerPoint Assignment for TEM 431Observation Lab PowerPoint Assignment for TEM 431
Observation Lab PowerPoint Assignment for TEM 431
ecamare2
 
Part 2 Deep Dive: Navigating the 2024 Slowdown
Part 2 Deep Dive: Navigating the 2024 SlowdownPart 2 Deep Dive: Navigating the 2024 Slowdown
Part 2 Deep Dive: Navigating the 2024 Slowdown
jeffkluth1
 
The Genesis of BriansClub.cm Famous Dark WEb Platform
The Genesis of BriansClub.cm Famous Dark WEb PlatformThe Genesis of BriansClub.cm Famous Dark WEb Platform
The Genesis of BriansClub.cm Famous Dark WEb Platform
SabaaSudozai
 
Chapter 7 Final business management sciences .ppt
Chapter 7 Final business management sciences .pptChapter 7 Final business management sciences .ppt
Chapter 7 Final business management sciences .ppt
ssuser567e2d
 
Organizational Change Leadership Agile Tour Geneve 2024
Organizational Change Leadership Agile Tour Geneve 2024Organizational Change Leadership Agile Tour Geneve 2024
Organizational Change Leadership Agile Tour Geneve 2024
Kirill Klimov
 
Brian Fitzsimmons on the Business Strategy and Content Flywheel of Barstool S...
Brian Fitzsimmons on the Business Strategy and Content Flywheel of Barstool S...Brian Fitzsimmons on the Business Strategy and Content Flywheel of Barstool S...
Brian Fitzsimmons on the Business Strategy and Content Flywheel of Barstool S...
Neil Horowitz
 

Recently uploaded (20)

一比一原版新西兰奥塔哥大学毕业证(otago毕业证)如何办理
一比一原版新西兰奥塔哥大学毕业证(otago毕业证)如何办理一比一原版新西兰奥塔哥大学毕业证(otago毕业证)如何办理
一比一原版新西兰奥塔哥大学毕业证(otago毕业证)如何办理
 
Digital Marketing with a Focus on Sustainability
Digital Marketing with a Focus on SustainabilityDigital Marketing with a Focus on Sustainability
Digital Marketing with a Focus on Sustainability
 
Dpboss Matka Guessing Satta Matta Matka Kalyan Chart Satta Matka
Dpboss Matka Guessing Satta Matta Matka Kalyan Chart Satta MatkaDpboss Matka Guessing Satta Matta Matka Kalyan Chart Satta Matka
Dpboss Matka Guessing Satta Matta Matka Kalyan Chart Satta Matka
 
❼❷⓿❺❻❷❽❷❼❽ Dpboss Matka Result Satta Matka Guessing Satta Fix jodi Kalyan Fin...
❼❷⓿❺❻❷❽❷❼❽ Dpboss Matka Result Satta Matka Guessing Satta Fix jodi Kalyan Fin...❼❷⓿❺❻❷❽❷❼❽ Dpboss Matka Result Satta Matka Guessing Satta Fix jodi Kalyan Fin...
❼❷⓿❺❻❷❽❷❼❽ Dpboss Matka Result Satta Matka Guessing Satta Fix jodi Kalyan Fin...
 
Building Your Employer Brand with Social Media
Building Your Employer Brand with Social MediaBuilding Your Employer Brand with Social Media
Building Your Employer Brand with Social Media
 
Creative Web Design Company in Singapore
Creative Web Design Company in SingaporeCreative Web Design Company in Singapore
Creative Web Design Company in Singapore
 
How MJ Global Leads the Packaging Industry.pdf
How MJ Global Leads the Packaging Industry.pdfHow MJ Global Leads the Packaging Industry.pdf
How MJ Global Leads the Packaging Industry.pdf
 
Unveiling the Dynamic Personalities, Key Dates, and Horoscope Insights: Gemin...
Unveiling the Dynamic Personalities, Key Dates, and Horoscope Insights: Gemin...Unveiling the Dynamic Personalities, Key Dates, and Horoscope Insights: Gemin...
Unveiling the Dynamic Personalities, Key Dates, and Horoscope Insights: Gemin...
 
The 10 Most Influential Leaders Guiding Corporate Evolution, 2024.pdf
The 10 Most Influential Leaders Guiding Corporate Evolution, 2024.pdfThe 10 Most Influential Leaders Guiding Corporate Evolution, 2024.pdf
The 10 Most Influential Leaders Guiding Corporate Evolution, 2024.pdf
 
Lundin Gold Corporate Presentation - June 2024
Lundin Gold Corporate Presentation - June 2024Lundin Gold Corporate Presentation - June 2024
Lundin Gold Corporate Presentation - June 2024
 
Zodiac Signs and Food Preferences_ What Your Sign Says About Your Taste
Zodiac Signs and Food Preferences_ What Your Sign Says About Your TasteZodiac Signs and Food Preferences_ What Your Sign Says About Your Taste
Zodiac Signs and Food Preferences_ What Your Sign Says About Your Taste
 
Digital Transformation Frameworks: Driving Digital Excellence
Digital Transformation Frameworks: Driving Digital ExcellenceDigital Transformation Frameworks: Driving Digital Excellence
Digital Transformation Frameworks: Driving Digital Excellence
 
Industrial Tech SW: Category Renewal and Creation
Industrial Tech SW:  Category Renewal and CreationIndustrial Tech SW:  Category Renewal and Creation
Industrial Tech SW: Category Renewal and Creation
 
Satta Matka Dpboss Matka Guessing Kalyan Chart Indian Matka Kalyan panel Chart
Satta Matka Dpboss Matka Guessing Kalyan Chart Indian Matka Kalyan panel ChartSatta Matka Dpboss Matka Guessing Kalyan Chart Indian Matka Kalyan panel Chart
Satta Matka Dpboss Matka Guessing Kalyan Chart Indian Matka Kalyan panel Chart
 
Observation Lab PowerPoint Assignment for TEM 431
Observation Lab PowerPoint Assignment for TEM 431Observation Lab PowerPoint Assignment for TEM 431
Observation Lab PowerPoint Assignment for TEM 431
 
Part 2 Deep Dive: Navigating the 2024 Slowdown
Part 2 Deep Dive: Navigating the 2024 SlowdownPart 2 Deep Dive: Navigating the 2024 Slowdown
Part 2 Deep Dive: Navigating the 2024 Slowdown
 
The Genesis of BriansClub.cm Famous Dark WEb Platform
The Genesis of BriansClub.cm Famous Dark WEb PlatformThe Genesis of BriansClub.cm Famous Dark WEb Platform
The Genesis of BriansClub.cm Famous Dark WEb Platform
 
Chapter 7 Final business management sciences .ppt
Chapter 7 Final business management sciences .pptChapter 7 Final business management sciences .ppt
Chapter 7 Final business management sciences .ppt
 
Organizational Change Leadership Agile Tour Geneve 2024
Organizational Change Leadership Agile Tour Geneve 2024Organizational Change Leadership Agile Tour Geneve 2024
Organizational Change Leadership Agile Tour Geneve 2024
 
Brian Fitzsimmons on the Business Strategy and Content Flywheel of Barstool S...
Brian Fitzsimmons on the Business Strategy and Content Flywheel of Barstool S...Brian Fitzsimmons on the Business Strategy and Content Flywheel of Barstool S...
Brian Fitzsimmons on the Business Strategy and Content Flywheel of Barstool S...
 

Web Design Course: CSS lecture 4

  • 1. Web Programming and Design CSS (Cascading Style Sheet) By : Gheyath M. Othman
  • 2. CSS Margin 2 • The CSS margin properties define the space around elements. • It 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. Like margin: 25px 50px 75px 100px; top right bottom left margin: 25px 50px 75px; top right+left bottom margin: 25px 50px; top+bottom right+left margin: 25px; top+bottom+right+left You can also use it separately: LIKE
  • 3. CSS Margin 3 All CSS margin properties: Property Description margin A shorthand property for setting the margin properties in one declaration margin-bottom Sets the bottom margin of an element margin-left Sets the left margin of an element margin-right Sets the right margin of an element margin-top Sets the top margin of an element
  • 4. CSS Margin 4 Example-1- Margin: Margin <!DOCTYPE html><html><head> <style> p.all { margin: 5px; } p.ex { margin: 100px 150px 100px 300px; } </style> </head> <body> <p>This is a paragraph with no specified margins</p> <p class="all">This is a paragraph with specified margins.all in one</p> <p class="ex">This is a paragraph with specified margins.</p> </body></html>
  • 5. CSS Padding 5 • The CSS padding properties define the space between the element border and the element content. • Padding clears an area around the content (inside border) of 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. Like padding: 25px 50px 75px; top right+left bottom padding: 25px; top+bottom+right+left Also you can use it separately. LIKE
  • 6. CSS Padding 6 padding: 25px 50px; top+bottom right+left All CSS padding properties: Property Description padding A shorthand property for setting all the padding properties in one declaration padding-bottom Sets the bottom padding of an element padding-left Sets the left padding of an element padding-right Sets the right padding of an element padding-top Sets the top padding of an element padding: 25px 50px 75px 100px; top right bottom left
  • 7. CSS Padding 7 Example -1- :padding <!DOCTYPE html><html><head> <style> p { background-color: yellow; } p.all { padding: 25px; } p.padding { padding: 25px 50px 75px 100px; } </style> </head> <body> <p>This is a paragraph with no specified padding.</p> <p class="all">This is a paragraph with specified paddings.</p> <p class="padding">This is a paragraph with specified paddings.</p> </body></html> Bottom padding Out_padd_border_margin
  • 8. CSS Dimensions 8 All CSS Dimension properties: The CSS dimension properties allow you to control the height and width of an element. Property Description height Sets the height of an element max-height Sets the maximum height of an element max-width Sets the maximum width of an element min-height Sets the minimum height of an element min-width Sets the minimum width of an element width Sets the width of an element example_dimen2
  • 9. CSS Dimensions 9 Example -1- : <!DOCTYPE html><html><head> <style> div { max-width: 500px; height: 100px; border: 3px solid #8AC007; } </style> </head> <body> <div> This div element has a height of 100px and a max-width of 500px. This div element has a height of 100px and a max-width of 500px. This div element has a height of 100px and a max-width of 500px. This div element has a height of 100px and a max-width of 500px. </div> </body></html>
  • 10. CSS Layout (overflow) 10 The overflow property specifies what to do if the content of an element exceeds the size of the element's box. Syntax overflow: auto, hidden, scroll
  • 11. Example 11 e2_overflow <!DOCTYPE html><html><head> <style> div.scroll { background-color: #00FFFF; width: 100px; height: 100px; overflow: scroll; } div.hidden { background-color: #00FF00; width: 100px; height: 100px; overflow: hidden; } div.auto { background-color: #00FF00; width: 100px; height: 100px; overflow: auto; } </style> </head> <body> <p>Result with overflow:scroll</p> <div class="scroll">You can use the overflow property when you want to have better control of the layout.</div> <p>Result with overflow:hidden</p> <div class="hidden">You can use the overflow property when you want to have better control of the layout. The default value is visible.</div> <p>Result with overflow:auto</p> <div class="auto">You can use the overflow property when you want to have better control of the layout. The default value is visible.</div> </body></html> e2_overflow
  • 12. CSS Layout (Float & Clear) 12 • The float property specifies whether or not an element should float. • The float property can be used to wrap text around images. Float property: float: left, right, none e1_float
  • 13. CSS Layout (Float & Clear) 13 Example-1-: e1_float <!DOCTYPE html><html><head> <style> img { float: right; margin: 0 0 10px 10px; } </style> </head> <body> <p>The image will float to the right in the paragraph, and the text in the paragraph will wrap around the image. <img src="../smiley.gif" alt="smiley.com" width="100" height="140"> In this example, the image will float to the right in the paragraph, and the text in the paragraph will wrap around the image.In this example, the image will float to the right in the paragraph, and the text in the paragraph will wrap around the image.In this example, the image will float to the right in the paragraph, and the text in the paragraph will wrap around the image.In this example, the image will float to the right in the paragraph, and the text in the paragraph will wrap around the image.</p> </body></html>
  • 14. CSS Layout (Float & Clear) 14 • The clear property is used to control the behavior of floating elements. • Elements after a floating element will flow around it. To avoid this, use the clear property. • The clear property specifies on which sides of an element floating elements are not allowed to float. Clear property: clear: left, right, both, none
  • 15. CSS Layout (Float & Clear) 15 Example-1-: e2_clear <!DOCTYPE html><html><head> <style> .div1,.div3 { float: left; width: 100px; height: 50px; margin: 10px; border: 3px solid #8AC007; } .div2 { border: 1px solid red; } .div4 { border: 1px solid red; clear: left; } </style> </head><body> <h2>Without clear</h2><div class="div1">div1</div> <div class="div2">div2 - Notice that the div2 element is after div1, in the HTML code. However, since div1 is floated to the left, this happens: the text in div2 is floated around div1, and div2 surrounds the whole thing.</div> <h2>Using clear</h2><div class="div3">div3</div> <div class="div4">div4 - Using clear moves div4 down below the floated div3. The value "left" clears elements floated to the left. You can also clear "right" and "both".</div> </body></html>
  • 16. CSS Layout (Display Property) 16 • The display property is the most important CSS property for controlling layout. • The display property specifies if/how an element is displayed. • Every HTML element has a default display value depending on what type of element it is. The default display value for most elements is block or inline.
  • 17. CSS Layout (Display :inline-block) 17 • It has been possible for a long time to create a grid of boxes that fills the browser width and wraps nicely (when the browser is resized), by using the float property. • However, the inline-block value of the display property makes this even easier. • inline-block elements are like inline elements but they can have a width and a height. • Example using float once and inline-block another, it has the same result. .floating-box { display: inline-block; width: 150px; height: 75px; margin: 10px; border: 3px solid #8AC007;} .floating-box { float: left; width: 150px; height: 75px; margin: 10px; border: 3px solid #8AC007;} e4-e3_inline-block+float
  • 18. CSS Layout (Display Property) 18 Div Examples of block-level elements: <div> <h1> - <h6> <p> A block-level element always starts on a new line and takes up the full width available (stretches out to the left and right as far as it can). Block-level Elements: Inline Elements: An inline element does not start on a new line and only takes up as much width as necessary. This is a paragraph.an inline <span> element inside Examples of Inline elements: • <span> • <a> • <img>
  • 19. Block-level & Inline Elements 19 Example: <!DOCTYPE html><html><head> <style> .ul1 li{ display: inline; } .ul2 li{ display: block; } </style> </head> <body><p>Display a list of links as a horizontal menu:INLINE</p> <ul class="ul1"> <li><a href="#home.html" >HTML</a></li> <li><a href="#home.html" >CSS</a></li> <li><a href="#home.html" >JavaScript</a></li></ul> <p>Display a list of links as a vertical menu:BLOCK</p> <ul class="ul2"> <li><a href="#home.html" >HTML</a></li> <li><a href="#home.html" >CSS</a></li> <li><a href="#home.html" >JavaScript</a></li> </ul> </body></html> e1_Inline-block
  • 20. CSS Layout (Display Property) 20 Hide an Element - display:none or visibility:hidden • Hiding an element can be done by setting the display property to none. The element will be hidden, and the page will be displayed as if the element is not there. h1.hidden { display: none; } h1.hidden { visibility: hidden; } • visibility:hidden; also hides an element However, the element will still take up the same space as before. The element will be hidden, but still affect the layout.
  • 21. Block-level & Inline Elements 21 Example: <!DOCTYPE html><html><head> <style> h1.hidden { display: none; } h2.hidden { visibility: hidden; } </style> </head> <body> <h1>This is a visible heading</h1> <h1 class="hidden">This is a hidden heading</h1> <p>Notice that the h1 element with display: none; does not take up any space.</p> <hr> <h2>This is a visible heading</h1> <h2 class="hidden">This is a hidden heading</h1> <p>Notice that the h2 element with visibility hidden; take up a space.</p> </body></html> display+visiblity Doesn’t Take the space