Docsity

Riassunto fondamenti HTML e CSS, Appunti di Tecniche E Linguaggi Di Programmazione

Toggle sidebar
bg1
HTML and CSS Fundamentals Review
STRUCTURE
•The <!DOCTYPE html> declaration should always be the first line of code
in your HTML files.
•The <html> element will contain all of your HTML code.
•Information about the web page, like the title, belongs within the <head>
of the page.
•You can add a title to your web page by using the <title> element,
inside of the head.
•Code for visible HTML content will be placed inside of the <body> element
COMMON ELEMENTS
•You can add headings of different sizes using the different headings
elements: <h1> through <h6>.
•Paragraphs are added with the <p> element.
•Unordered lists are created with the <ul> element and list items are
added using the <li> element.
•Ordered lists are created with the <ol> element and list items are added
using the <li> element.
•You can add links to your web page using the <a> element - don't forget
the href attribute!
•Images can be added with the <img> element - don't forget the src
attribute!
•Images help support visually impaired users when <img> elements
include the alt attribute.
•You can turn anything into a link by wrapping it with an <a> element.
•White space in the HTML file does not affect the positioning of elements
in the browser.
•The W3C recommends 2 spaces of indentation for nested HTML
elements.
•Comments are used to take notes inside of an HTML file. You can add a
comment with <!-- This is a comment -->.
pf3
pf4
pf5

Anteprima parziale del testo

Scarica Riassunto fondamenti HTML e CSS e più Appunti in PDF di Tecniche E Linguaggi Di Programmazione solo su Docsity!

HTML and CSS Fundamentals Review

STRUCTURE

  • The declaration should always be the first line of code in your HTML files.
  • The element will contain all of your HTML code.
  • Information about the web page, like the title, belongs within the of the page.
  • You can add a title to your web page by using the element, inside of the head.
  • Code for visible HTML content will be placed inside of the <body> element

COMMON ELEMENTS

  • You can add headings of different sizes using the different headings elements: <h1> through <h6>.
  • Paragraphs are added with the <p> element.
  • Unordered lists are created with the <ul> element and list items are added using the <li> element.
  • Ordered lists are created with the <ol> element and list items are added using the <li> element.
  • You can add links to your web page using the <a> element - don't forget the href attribute!
  • Images can be added with the <img> element - don't forget the src attribute!
  • Images help support visually impaired users when <img> elements include the alt attribute.
  • You can turn anything into a link by wrapping it with an <a> element.
  • White space in the HTML file does not affect the positioning of elements in the browser.
  • The W3C recommends 2 spaces of indentation for nested HTML elements.
  • Comments are used to take notes inside of an HTML file. You can add a comment with <!-- This is a comment -->.

CSS SETUP

HTML and CSS are kept in separate files in order to keep code maintainable and readable, as well as keep structure separate from styling.

  • The
  • Text can be aligned with the text-align property.

IDs, CLASSES, DIVs

Code is a lot more readable when it is organized using IDs, classes, and divs.

  1. IDs label HTML elements that are unique to the web page (an element that appears only once ).
  2. Classes label elements that will share the same styling. They make styling more efficient.
  3. The groups elements together. It makes the HTML file easier to read by organizing the web page into logical sections.
  4. HTML elements can be labeled with multiple classes.
  5. Divs are one of the most commonly used HTML elements. Understanding how they are used is a critical skill for web developers.

BOX MODEL

All HTML elements are contained within a box.

  • Boxes have two dimensions: a width and a height. These dimensions can be modified with the width and height properties.
  • Width and height dimensions can be set using one of three units of measurement: pixels, ems, or percentages.
  • A minimum and maximum width or height can be set for a box. This helps ensure that content remains legible when a user shrinks or expands their browser window.
  • If an element's box becomes too small, the content may overflow. The overflowed content can be controlled with the overflow property.

BORDERS

You can style the borders of an element's box.

  • The border-width property allows you to set the thickness, or width, of a border.
  • The border-style property allows you to change the style of border used.
  • The border-color property allows you to change the color of a border.
  • Individually setting the style, thickness, and color of a border can bloat code. It's more efficient to use the shorthand border property and specify all three properties at once, in that order.
  • Box borders don't have to be square. Their corners can be rounded with the border-radius property.

CONTENT

Padding is the spacing between a box's content and the borders of the box.

  • padding can be set equally on all sides of the content, or can be set specifically for certain sides of the content only.
  • margin is the spacing directly outside of a box's borders.
  • Margins can be set equally on all sides of a box, or can be set specifically for certain sides of the box only.
  • The display changes the default behavior of HTML elements.
  • The visibility property hides an element, but does not remove the amount of space the element takes up on the page. If you want to hide that element and remove the empty space, use the display property instead.

NEW BOX MODEL

In the default box model, box dimensions are affected by border thickness and padding.

  • The box-sizing property controls the box model used by the browser.
  • The default value of the box-sizing property is content-box.
  • The value for the new box model is border-box.
  • The border-box model is not affected by border thickness or padding.

LAYOUT

  • The position property allows you to specify the position of an element in three different ways. ➢ When set to relative, an element's position is relative to its default position on the page.