SlideShare ist ein Scribd-Unternehmen logo
1 von 22
CSS
CSS Fonts
ď‚— Choosing the right font has a huge impact on how
the readers experience a website.
ď‚— The right font can create a strong identity for your
brand.
ď‚— Using a font that is easy to read is important. The
font adds value to your text. It is also important to
choose the correct color and text size for the font.
Generic Font Families
In CSS there are five generic font families:
1. Serif fonts have a small stroke at the edges of
each letter. They create a sense of formality and
elegance.
2. Sans-serif fonts have clean lines (no small
strokes attached). They create a modern and
minimalistic look.
3. Monospace fonts - here all the letters have the
same fixed width. They create a mechanical
look.
4. Cursive fonts imitate human handwriting.
5. Fantasy fonts are decorative/playful fonts.
All the different font names belong to one
of the generic font families.
The CSS font-family Property
The font-family property should hold several font
names as a "fallback" system, to ensure
maximum compatibility between
browsers/operating systems. Start with the font
you want, and end with a generic family (to let the
browser pick a similar font in the generic family, if
no other fonts are available). The font names
should be separated with comma
If the font name is more than one word, it must be in
quotation marks, like: "Times New Roman".
.p1 {
font-family: "Times New Roman", Times, serif;
}
.p2 {
font-family: Arial, Helvetica, sans-serif;
}
.p3 {
font-family: "Lucida Console", "Courier New",
monospace;
}
<div> tag
The <div> tag defines a division or a section in
an HTML document. The <div> tag is used as a
container for HTML elements - which is then
styled with CSS or manipulated with JavaScript.
The <div> tag is easily styled by using the class
or id attribute. Any sort of content can be put
inside the <div> tag!
<!DOCTYPE html>
<html>
<head>
<style>
div {
border: 1px solid gray;
padding: 8px;
}
h1 {
text-align: center;
text-transform: uppercase;
color: #4CAF50;
}
p {
text-indent: 50px;
text-align: justify;
letter-spacing: 3px;
}
</style>
</head>
<body>
<div>
<h1>text formatting</h1>
<p>This text is styled with some of the text
formatting properties. The heading uses the text-
align, text-transform, and color properties.
The paragraph is indented, aligned, and the
space between characters is specified. The
underline is removed from this colored
</p>
</div>
</body>
</html>
What are browser developer
tools?
ď‚— Every modern web browser includes a powerful
suite of developer tools. These tools do a range
of things, from inspecting currently-loaded HTML,
CSS and JavaScript to showing which assets the
page has requested and how long they took to
load.
The HTML DOM (Document Object Model)
ď‚— When a web page is loaded, the browser creates
a Document Object Model of the page.
ď‚— The HTML DOM model is constructed as a tree
of Objects:
What is the DOM?
ď‚— DOM defines a standard for accessing documents:
ď‚— "The Document Object Model (DOM) is a platform
and language-neutral interface that allows programs
and scripts to dynamically access and update the
content, structure, and style of a document."
The DOM standard is separated into 3 different parts:
ď‚— Core DOM - standard model for all document types
ď‚— XML DOM - standard model for XML documents
ď‚— HTML DOM - standard model for HTML documents
HTML DOM
HTML DOM is a standard object model
and programming interface for HTML. It defines:
ď‚— The HTML elements as objects
ď‚— The properties of all HTML elements
ď‚— The methods to access all HTML elements
ď‚— The events for all HTML elements
In other words: The HTML DOM is a standard for how
to get, change, add, or delete HTML elements.
HTML and debugging
ď‚— HTML is not as complicated to understand as
Rust. HTML is not compiled into a different form
before the browser parses it and shows the result
(it is interpreted, not compiled). And
HTML's element syntax is arguably a lot easier to
understand than a "real programming language"
like Rust, JavaScript, or Python.
Permissive code
ď‚— generally when you do something wrong in code,
there are two main types of error that you'll come
across:
Syntax errors: These are spelling or punctuation errors in your code
that actually cause the program not to run, like the Rust error shown
above. These are usually easy to fix as long as you are familiar with
the language's syntax and know what the error messages mean.
Logic errors: These are errors where the syntax is actually correct,
but the code is not what you intended it to be, meaning that the
program runs incorrectly. These are often harder to fix than syntax
errors, as there isn't an error message to direct you to the source of
the error.
HTML itself doesn't suffer from syntax errors because browsers parse it
permissively, meaning that the page still displays even if there are
syntax errors. Browsers have built-in rules to state how to interpret
incorrectly written markup, so you'll get something running, even if it is
not what you expected. This, of course, can still be a problem!
Note: HTML is parsed permissively because when the web was first created, it
was decided that allowing people to get their content published was more
important than making sure the syntax was absolutely correct. The web would
probably not be as popular as it is today, if it had been more strict from the very
ď‚— <h1>HTML debugging examples</h1>
ď‚— <p>What causes errors in HTML?
ď‚— <ul>
<li>Unclosed elements: If an element is <strong>not closed properly,
then its effect can spread to areas you didn't intend
<li>Badly nested elements: Nesting elements properly is also very
important
for code behaving correctly. <strong>strong <em>strong
emphasized?</strong>
what is this?</em>
<li>Unclosed attributes: Another common source of HTML problems.
Let's
look at an example: <a href="https://www.mozilla.org/>link to Mozilla
homepage</a>
ď‚— </ul>
ď‚— The paragraph and list item elements have no closing
tags. Looking at the image above, this doesn't seem
to have affected the markup rendering too badly, as it
is easy to infer where one element should end and
another should begin.
ď‚— The first <strong> element has no closing tag. This is
a bit more problematic, as it isn't easy to tell where
the element is supposed to end. In fact, the whole of
the rest of the text has been strongly emphasized.
ď‚— This section is badly nested: <strong>strong
<em>strong emphasized?</strong> what is
this?</em>. It is not easy to tell how this has been
interpreted because of the previous problem.
ď‚— The href attribute value is missing a closing double
quote. This seems to have caused the biggest
problem — the link has not rendered at all.
CSS Debugging
ď‚— Debugging in CSS means figuring out what might
be the problem when you have unexpected layout
results.
Common Causes Of CSS Bugs
CSS layout issues often fall out of one of the following
categories:
Overflow of content from its parent resulting in extra or unexpected
scrollbars and content being pushed out of the regular viewport area.
Inheriting browser inconsistencies leading to mixed results across
browsers and devices.
Unexpected inheritance from the cascade where multiple styles override
one another, which may cause alignment and spacing issues, among other
things.
CSS resiliency failures from DOM changes, including when child elements
have gained wrapping divs or additional elements are unexpectedly added.
Debugging Overflow
ď‚— Overflow is usually one of the most apparent
issues and can be pretty frustrating. It’s not
always evident at a glance which element is
causing overflow, and it can be tedious to try to
comb through elements using dev tools
inspectors.
ď‚— A tried and true method to begin figuring out
which element is responsible for overflow is to
add the following CSS:
* {
outline: 1px solid red;
}
Why outline instead of border? Because it will not add to the element’s computed DOM size.
Adding borders will change element appearances if they’re already using a border and may
falsely cause additional overflow issues.
ď‚— The intent of using outline is to reveal element
boundaries and visualize how elements are nested.
For example, if overflow is causing unexpected
scrollbars, an outline can help point out which
element is pushing out of the viewport.
ď‚— In addition to this manual method, Firefox reveals
scrolling elements and specify which elements have
children causing overflow, as seen in this
COMMON CAUSES OF
OVERFLOW #
 Typically when we’re concerned about overflow
problems, it’s from a mismatch of width
allowances between a parent element and its
children.
ď‚— One of the first things to check is if an element
has set an absolute width without a responsive
method to allow it to fully resize downwards. For
example, a 600px box will trigger overflow on
viewports narrower than 600px. Instead, you may
be able to adjust to add in a max-width: 100% so
that the element will also responsively resize:
.wide-element {
width: 600px;
max-width: 100%;
}
we can account for that margin by using the CSS math function calc to subtract the total area
used by the horizontal margins:
p:first-of-type {
width: 800px;
max-width: calc(100% - 6rem);
margin: 3rem;
}

Weitere ähnliche Inhalte

Ă„hnlich wie Lecture-7.pptx

Lesson 8 Computer Creating your Website.pdf
Lesson 8 Computer Creating your Website.pdfLesson 8 Computer Creating your Website.pdf
Lesson 8 Computer Creating your Website.pdfAshleyJovelClavecill
 
An Seo’s Intro to Web Dev, HTML, CSS and JavaScript
An Seo’s Intro to Web Dev, HTML, CSS and JavaScriptAn Seo’s Intro to Web Dev, HTML, CSS and JavaScript
An Seo’s Intro to Web Dev, HTML, CSS and JavaScriptTroyfawkes
 
Making Your Site Look Great in IE7
Making Your Site Look Great in IE7Making Your Site Look Great in IE7
Making Your Site Look Great in IE7goodfriday
 
Css 2010
Css 2010Css 2010
Css 2010Cathie101
 
Sitepoint.com a basic-html5_template
Sitepoint.com a basic-html5_templateSitepoint.com a basic-html5_template
Sitepoint.com a basic-html5_templateDaniel Downs
 
What is html xml and xhtml
What is html xml and xhtmlWhat is html xml and xhtml
What is html xml and xhtmlFkdiMl
 
GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1Heather Rock
 
Organize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS TricksOrganize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS TricksAndolasoft Inc
 
01 Introduction To CSS
01 Introduction To CSS01 Introduction To CSS
01 Introduction To CSScrgwbr
 
The Language of the Web - HTML and CSS
The Language of the Web - HTML and CSSThe Language of the Web - HTML and CSS
The Language of the Web - HTML and CSSkcasavale
 
HTML Foundations, part 1
HTML Foundations, part 1HTML Foundations, part 1
HTML Foundations, part 1Shawn Calvert
 

Ă„hnlich wie Lecture-7.pptx (20)

Lesson 8 Computer Creating your Website.pdf
Lesson 8 Computer Creating your Website.pdfLesson 8 Computer Creating your Website.pdf
Lesson 8 Computer Creating your Website.pdf
 
ARTICULOENINGLES
ARTICULOENINGLESARTICULOENINGLES
ARTICULOENINGLES
 
Presentation 1 [autosaved]
Presentation 1 [autosaved]Presentation 1 [autosaved]
Presentation 1 [autosaved]
 
Css
CssCss
Css
 
An Seo’s Intro to Web Dev, HTML, CSS and JavaScript
An Seo’s Intro to Web Dev, HTML, CSS and JavaScriptAn Seo’s Intro to Web Dev, HTML, CSS and JavaScript
An Seo’s Intro to Web Dev, HTML, CSS and JavaScript
 
HTML Bootcamp
HTML BootcampHTML Bootcamp
HTML Bootcamp
 
Css basics
Css basicsCss basics
Css basics
 
Css basics
Css basicsCss basics
Css basics
 
Making Your Site Look Great in IE7
Making Your Site Look Great in IE7Making Your Site Look Great in IE7
Making Your Site Look Great in IE7
 
Css 2010
Css 2010Css 2010
Css 2010
 
Css 2010
Css 2010Css 2010
Css 2010
 
Sitepoint.com a basic-html5_template
Sitepoint.com a basic-html5_templateSitepoint.com a basic-html5_template
Sitepoint.com a basic-html5_template
 
What is html xml and xhtml
What is html xml and xhtmlWhat is html xml and xhtml
What is html xml and xhtml
 
GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1
 
Class13
Class13Class13
Class13
 
Organize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS TricksOrganize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS Tricks
 
Html
HtmlHtml
Html
 
01 Introduction To CSS
01 Introduction To CSS01 Introduction To CSS
01 Introduction To CSS
 
The Language of the Web - HTML and CSS
The Language of the Web - HTML and CSSThe Language of the Web - HTML and CSS
The Language of the Web - HTML and CSS
 
HTML Foundations, part 1
HTML Foundations, part 1HTML Foundations, part 1
HTML Foundations, part 1
 

Mehr von vishal choudhary

SE-CyclomaticComplexityand Testing.ppt
SE-CyclomaticComplexityand Testing.pptSE-CyclomaticComplexityand Testing.ppt
SE-CyclomaticComplexityand Testing.pptvishal choudhary
 
SE-coupling and cohesion.ppt
SE-coupling and cohesion.pptSE-coupling and cohesion.ppt
SE-coupling and cohesion.pptvishal choudhary
 
SE-software design.ppt
SE-software design.pptSE-software design.ppt
SE-software design.pptvishal choudhary
 
Multimedia-Lecture-Animation.pptx
Multimedia-Lecture-Animation.pptxMultimedia-Lecture-Animation.pptx
Multimedia-Lecture-Animation.pptxvishal choudhary
 
MultimediaLecture5.pptx
MultimediaLecture5.pptxMultimediaLecture5.pptx
MultimediaLecture5.pptxvishal choudhary
 
Multimedia-Lecture-7.pptx
Multimedia-Lecture-7.pptxMultimedia-Lecture-7.pptx
Multimedia-Lecture-7.pptxvishal choudhary
 
MultiMedia-Lecture-4.pptx
MultiMedia-Lecture-4.pptxMultiMedia-Lecture-4.pptx
MultiMedia-Lecture-4.pptxvishal choudhary
 
Multimedia-Lecture-6.pptx
Multimedia-Lecture-6.pptxMultimedia-Lecture-6.pptx
Multimedia-Lecture-6.pptxvishal choudhary
 
Multimedia-Lecture-3.pptx
Multimedia-Lecture-3.pptxMultimedia-Lecture-3.pptx
Multimedia-Lecture-3.pptxvishal choudhary
 

Mehr von vishal choudhary (20)

SE-Lecture1.ppt
SE-Lecture1.pptSE-Lecture1.ppt
SE-Lecture1.ppt
 
SE-Testing.ppt
SE-Testing.pptSE-Testing.ppt
SE-Testing.ppt
 
SE-CyclomaticComplexityand Testing.ppt
SE-CyclomaticComplexityand Testing.pptSE-CyclomaticComplexityand Testing.ppt
SE-CyclomaticComplexityand Testing.ppt
 
SE-Lecture-7.pptx
SE-Lecture-7.pptxSE-Lecture-7.pptx
SE-Lecture-7.pptx
 
Se-Lecture-6.ppt
Se-Lecture-6.pptSe-Lecture-6.ppt
Se-Lecture-6.ppt
 
SE-Lecture-5.pptx
SE-Lecture-5.pptxSE-Lecture-5.pptx
SE-Lecture-5.pptx
 
XML.pptx
XML.pptxXML.pptx
XML.pptx
 
SE-Lecture-8.pptx
SE-Lecture-8.pptxSE-Lecture-8.pptx
SE-Lecture-8.pptx
 
SE-coupling and cohesion.ppt
SE-coupling and cohesion.pptSE-coupling and cohesion.ppt
SE-coupling and cohesion.ppt
 
SE-Lecture-2.pptx
SE-Lecture-2.pptxSE-Lecture-2.pptx
SE-Lecture-2.pptx
 
SE-software design.ppt
SE-software design.pptSE-software design.ppt
SE-software design.ppt
 
SE1.ppt
SE1.pptSE1.ppt
SE1.ppt
 
SE-Lecture-4.pptx
SE-Lecture-4.pptxSE-Lecture-4.pptx
SE-Lecture-4.pptx
 
SE-Lecture=3.pptx
SE-Lecture=3.pptxSE-Lecture=3.pptx
SE-Lecture=3.pptx
 
Multimedia-Lecture-Animation.pptx
Multimedia-Lecture-Animation.pptxMultimedia-Lecture-Animation.pptx
Multimedia-Lecture-Animation.pptx
 
MultimediaLecture5.pptx
MultimediaLecture5.pptxMultimediaLecture5.pptx
MultimediaLecture5.pptx
 
Multimedia-Lecture-7.pptx
Multimedia-Lecture-7.pptxMultimedia-Lecture-7.pptx
Multimedia-Lecture-7.pptx
 
MultiMedia-Lecture-4.pptx
MultiMedia-Lecture-4.pptxMultiMedia-Lecture-4.pptx
MultiMedia-Lecture-4.pptx
 
Multimedia-Lecture-6.pptx
Multimedia-Lecture-6.pptxMultimedia-Lecture-6.pptx
Multimedia-Lecture-6.pptx
 
Multimedia-Lecture-3.pptx
Multimedia-Lecture-3.pptxMultimedia-Lecture-3.pptx
Multimedia-Lecture-3.pptx
 

KĂĽrzlich hochgeladen

ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxleah joy valeriano
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Food processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsFood processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsManeerUddin
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 

KĂĽrzlich hochgeladen (20)

ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Food processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsFood processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture hons
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 

Lecture-7.pptx

  • 1. CSS
  • 2. CSS Fonts ď‚— Choosing the right font has a huge impact on how the readers experience a website. ď‚— The right font can create a strong identity for your brand. ď‚— Using a font that is easy to read is important. The font adds value to your text. It is also important to choose the correct color and text size for the font.
  • 3. Generic Font Families In CSS there are five generic font families: 1. Serif fonts have a small stroke at the edges of each letter. They create a sense of formality and elegance. 2. Sans-serif fonts have clean lines (no small strokes attached). They create a modern and minimalistic look. 3. Monospace fonts - here all the letters have the same fixed width. They create a mechanical look. 4. Cursive fonts imitate human handwriting. 5. Fantasy fonts are decorative/playful fonts. All the different font names belong to one of the generic font families.
  • 4. The CSS font-family Property The font-family property should hold several font names as a "fallback" system, to ensure maximum compatibility between browsers/operating systems. Start with the font you want, and end with a generic family (to let the browser pick a similar font in the generic family, if no other fonts are available). The font names should be separated with comma If the font name is more than one word, it must be in quotation marks, like: "Times New Roman".
  • 5. .p1 { font-family: "Times New Roman", Times, serif; } .p2 { font-family: Arial, Helvetica, sans-serif; } .p3 { font-family: "Lucida Console", "Courier New", monospace; }
  • 6. <div> tag The <div> tag defines a division or a section in an HTML document. The <div> tag is used as a container for HTML elements - which is then styled with CSS or manipulated with JavaScript. The <div> tag is easily styled by using the class or id attribute. Any sort of content can be put inside the <div> tag!
  • 7. <!DOCTYPE html> <html> <head> <style> div { border: 1px solid gray; padding: 8px; } h1 { text-align: center; text-transform: uppercase; color: #4CAF50; } p { text-indent: 50px; text-align: justify; letter-spacing: 3px; } </style> </head> <body> <div> <h1>text formatting</h1> <p>This text is styled with some of the text formatting properties. The heading uses the text- align, text-transform, and color properties. The paragraph is indented, aligned, and the space between characters is specified. The underline is removed from this colored </p> </div> </body> </html>
  • 8. What are browser developer tools? ď‚— Every modern web browser includes a powerful suite of developer tools. These tools do a range of things, from inspecting currently-loaded HTML, CSS and JavaScript to showing which assets the page has requested and how long they took to load.
  • 9.
  • 10. The HTML DOM (Document Object Model) ď‚— When a web page is loaded, the browser creates a Document Object Model of the page. ď‚— The HTML DOM model is constructed as a tree of Objects:
  • 11. What is the DOM? ď‚— DOM defines a standard for accessing documents: ď‚— "The Document Object Model (DOM) is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document." The DOM standard is separated into 3 different parts: ď‚— Core DOM - standard model for all document types ď‚— XML DOM - standard model for XML documents ď‚— HTML DOM - standard model for HTML documents
  • 12. HTML DOM HTML DOM is a standard object model and programming interface for HTML. It defines: ď‚— The HTML elements as objects ď‚— The properties of all HTML elements ď‚— The methods to access all HTML elements ď‚— The events for all HTML elements In other words: The HTML DOM is a standard for how to get, change, add, or delete HTML elements.
  • 13. HTML and debugging ď‚— HTML is not as complicated to understand as Rust. HTML is not compiled into a different form before the browser parses it and shows the result (it is interpreted, not compiled). And HTML's element syntax is arguably a lot easier to understand than a "real programming language" like Rust, JavaScript, or Python.
  • 14. Permissive code ď‚— generally when you do something wrong in code, there are two main types of error that you'll come across: Syntax errors: These are spelling or punctuation errors in your code that actually cause the program not to run, like the Rust error shown above. These are usually easy to fix as long as you are familiar with the language's syntax and know what the error messages mean. Logic errors: These are errors where the syntax is actually correct, but the code is not what you intended it to be, meaning that the program runs incorrectly. These are often harder to fix than syntax errors, as there isn't an error message to direct you to the source of the error. HTML itself doesn't suffer from syntax errors because browsers parse it permissively, meaning that the page still displays even if there are syntax errors. Browsers have built-in rules to state how to interpret incorrectly written markup, so you'll get something running, even if it is not what you expected. This, of course, can still be a problem! Note: HTML is parsed permissively because when the web was first created, it was decided that allowing people to get their content published was more important than making sure the syntax was absolutely correct. The web would probably not be as popular as it is today, if it had been more strict from the very
  • 15.
  • 16. ď‚— <h1>HTML debugging examples</h1> ď‚— <p>What causes errors in HTML? ď‚— <ul> <li>Unclosed elements: If an element is <strong>not closed properly, then its effect can spread to areas you didn't intend <li>Badly nested elements: Nesting elements properly is also very important for code behaving correctly. <strong>strong <em>strong emphasized?</strong> what is this?</em> <li>Unclosed attributes: Another common source of HTML problems. Let's look at an example: <a href="https://www.mozilla.org/>link to Mozilla homepage</a> ď‚— </ul>
  • 17. ď‚— The paragraph and list item elements have no closing tags. Looking at the image above, this doesn't seem to have affected the markup rendering too badly, as it is easy to infer where one element should end and another should begin. ď‚— The first <strong> element has no closing tag. This is a bit more problematic, as it isn't easy to tell where the element is supposed to end. In fact, the whole of the rest of the text has been strongly emphasized. ď‚— This section is badly nested: <strong>strong <em>strong emphasized?</strong> what is this?</em>. It is not easy to tell how this has been interpreted because of the previous problem. ď‚— The href attribute value is missing a closing double quote. This seems to have caused the biggest problem — the link has not rendered at all.
  • 18. CSS Debugging ď‚— Debugging in CSS means figuring out what might be the problem when you have unexpected layout results. Common Causes Of CSS Bugs CSS layout issues often fall out of one of the following categories: Overflow of content from its parent resulting in extra or unexpected scrollbars and content being pushed out of the regular viewport area. Inheriting browser inconsistencies leading to mixed results across browsers and devices. Unexpected inheritance from the cascade where multiple styles override one another, which may cause alignment and spacing issues, among other things. CSS resiliency failures from DOM changes, including when child elements have gained wrapping divs or additional elements are unexpectedly added.
  • 19. Debugging Overflow ď‚— Overflow is usually one of the most apparent issues and can be pretty frustrating. It’s not always evident at a glance which element is causing overflow, and it can be tedious to try to comb through elements using dev tools inspectors. ď‚— A tried and true method to begin figuring out which element is responsible for overflow is to add the following CSS: * { outline: 1px solid red; } Why outline instead of border? Because it will not add to the element’s computed DOM size. Adding borders will change element appearances if they’re already using a border and may falsely cause additional overflow issues.
  • 20. ď‚— The intent of using outline is to reveal element boundaries and visualize how elements are nested. For example, if overflow is causing unexpected scrollbars, an outline can help point out which element is pushing out of the viewport. ď‚— In addition to this manual method, Firefox reveals scrolling elements and specify which elements have children causing overflow, as seen in this
  • 21. COMMON CAUSES OF OVERFLOW # ď‚— Typically when we’re concerned about overflow problems, it’s from a mismatch of width allowances between a parent element and its children. ď‚— One of the first things to check is if an element has set an absolute width without a responsive method to allow it to fully resize downwards. For example, a 600px box will trigger overflow on viewports narrower than 600px. Instead, you may be able to adjust to add in a max-width: 100% so that the element will also responsively resize: .wide-element { width: 600px; max-width: 100%; }
  • 22. we can account for that margin by using the CSS math function calc to subtract the total area used by the horizontal margins: p:first-of-type { width: 800px; max-width: calc(100% - 6rem); margin: 3rem; }