The margin property in CSS specifies the space outside an element’s border.
Example
Utilizing CSS border and margin properties:
p { border: 2px solid powderblue; margin: 50px; } |
Click to Learn
Link to External CSS
External stylesheets can be linked using either a complete URL or a path that is relative to the current webpage.
Example
Using CSS border and margin properties:
<link rel=”stylesheet” href=”https://www.w3schools.com/html/styles.css”> |
Example
<link rel=”stylesheet” href=”/html/styles.css”> |
Example
<link rel=”stylesheet” href=”styles.css”> |
Click to Learn
Chapter Summary
- For inline styling, utilize the ‘style‘ attribute within HTML tags.
- For defining internal CSS, employ a ‘<style>‘ tag inside the HTML document.
- To link to an external CSS file, use a ‘<link>‘ element.
- Store ‘<style>‘ and ‘<link>‘ elements within the ‘<head>‘ section of the HTML document.
- To change text colors, apply the ‘color‘ property in CSS.
- To set the font type for text, use the ‘font-family‘ property in CSS.
- To adjust text sizes, use the ‘font-size‘ property in CSS.
- For creating borders, utilize the ‘border‘ property in CSS.
- For adding space inside borders, employ the ‘padding‘ property in CSS.
- For adding space outside borders, use the ‘margin‘ property in CSS.
HTML Style Tags
The <style>
tag is used to specify styling details for an HTML document, while the <link>
tag is used to establish a connection between the document and an external resource.