Advertisement
Patrikrizek

lesson-3-index

Jun 22nd, 2022
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.34 KB | None | 0 0
  1.  
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5.     <title>Basic Styles for text</title>
  6.     <!-- Internal CSS -->
  7.     <style>
  8.         /* Head CSS styling using Globals, Class and IDs attributes */
  9.        
  10.         /* Globals */
  11.         /* Globals affecting all specific elements in the page. */
  12.         body {
  13.             background-color: lightskyblue;
  14.         }
  15.  
  16.         /* Classes */
  17.         /* Multiple HTML elements can share same class. */
  18.         /* Can be used on any HTML element. */
  19.         /* The class name is case sensitive. */
  20.         /* Syntax: A period (.) character, followed by a class name. Define the CSS properties within curly braces {}. */
  21.         .city {
  22.             background-color: tomato;
  23.             color: white;
  24.             padding: 10px;
  25.         }
  26.  
  27.         .town {
  28.             font-family: 'Courier New', Courier, monospace;
  29.             font-size: 20px;
  30.             font-weight: bold;
  31.         }
  32.  
  33.         /* IDs */
  34.         /* Use to specify a unique ID for an HTML element */
  35.         /* You cannot have more than one element with the same ID in HTML document. */
  36.         /* Can be used for any HTML element. */
  37.         /* Used to point to a specific style declaration in a style sheet. */
  38.         /* Used by JavaScript to access and manipulate the element with the specific ID. */
  39.         /* The ID name is case sensitive. */
  40.         /* The ID name must contain at least one character, cannot start with a number, and mist not contain white spaces (space, tabs, etc.). */
  41.         /* Syntax: A hash (#) character, followed by a ID name. Define the CSS properties within curly braces {}. */
  42.         #myHeader {
  43.             background-color: lightblue;
  44.             color: black;
  45.             padding: 40px;
  46.             text-align: center;
  47.         }
  48.  
  49.         #C1 {
  50.             margin-top: 500px;
  51.         }
  52.     </style>
  53. </head>
  54. <body>
  55.     <!-- Div element is used as container for other HTML elements. -->
  56.     <div>
  57.         <p>This is an example of "div" with two paragraphs in it.</p>
  58.         <p>This is the second paragraph in "div".</p>
  59.     </div>
  60.  
  61.     <!-- Span - inline element -->
  62.     <span>Span element does not start on a new line.</span>
  63.     <span>As you can see this is the second span element that is placed immediately after the first one.</span>
  64.  
  65.     <!-- Span inside paragraph -->
  66.     <p>Span element can be placed inside a paragraph.
  67.         <span style="color:red;">It's used for styling part of the text in the paragraph.</span>
  68.     </p>
  69.  
  70.     <!-- Example of applying class to HTML element.  -->
  71.     <p class="city">This paragraph is styled by CSS "city" class.</p>
  72.    
  73.     <!-- Example of applying two classes to HTML element.  -->
  74.     <!-- To define multiple classes, separate the class names with a space.  -->
  75.     <!-- Element will be styled to all specified classes. -->
  76.     <p class="city town">This paragraph is styled by CSS "city" and "town" classes.</p>
  77.    
  78.     <!-- Example of applying ID to HTML element.  -->
  79.     <p id="myHeader">This paragraph is styled by CSS "myHeader" ID.</p>
  80.  
  81.     <!-- HTML Bookmarks -->
  82.     <!-- Used to jump to specific parts of a webpage. -->
  83.     <!-- Will jump to element with od="C1". -->
  84.     <a href="#C1">Jump to Chapter 1</a>
  85.  
  86.     <div id="C1">
  87.         <h3>Chapter One</h3>
  88.         <p>This is a paragraph of the chapter one.</p>
  89.     </div>
  90. </body>
  91. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement