HTML & CSS Basics to Pro
- 51Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
- spaceFlip card
- KI knew it
- DI didn't know it
- ←Previous card
- →Next card
What is HTML?
Hypertext Markup Language - a tool used to create websites.
Or swipe the card
51 cards
What is HTML?
Hypertext Markup Language - a tool used to create websites.
What is CSS?
Cascading Style Sheets - used to style the appearance of HTML elements.
What is an HTML element?
Anything displayed on a webpage, such as a button, paragraph, or link.
What is the difference between an opening tag and a closing tag?
A closing tag has a slash before the tag name (e.g., ), while an opening tag does not (e.g., ).
What is an HTML attribute?
Modifies the behavior of an element, e.g.,
hrefon an anchor element to set the link destination.How are multiple spaces and new lines handled in HTML?
Extra spaces and new lines are collapsed into a single space by the browser.
What is a void element in HTML?
An element that does not require a closing tag, such as
<img>or<input>.How do you write a CSS rule?
selector { property: value; }How do you target an HTML element by its class in CSS?
Use a dot (
.) followed by the class name, e.g.,.subscribe-button.What is a CSS pseudo-class?
Adds styles in a specific state, e.g.,
:hoverfor when the mouse is over the element.How do you create a smooth transition between styles in CSS?
Use the
transitionproperty with the property to animate and the duration, e.g.,transition: opacity 0.15s;What are the four values of the
box-shadowproperty?Horizontal offset, vertical offset, blur radius, and color (e.g.,
5px 5px 10px rgba(0,0,0,0.15)).How do you open Chrome DevTools?
Right-click on a webpage and select 'Inspect'.
How do you inspect a specific element in DevTools?
Click the pointer icon in the top-left corner, then click the element on the page.
What is the CSS box model?
The box model consists of margin (outside spacing), border, padding (inside spacing), and the content area.
What is the difference between margin and padding?
Margin is space outside the element's border; padding is space inside the border, around the content.
How do you change the font of an element in CSS?
Use the
font-familyproperty, e.g.,font-family: Arial;How do you make text bold in CSS?
Use
font-weight: bold;or a numeric value like 700.How do you center text horizontally?
Set
text-align: center;What is the
<span>element used for?To style a specific part of text inline without affecting the whole block.
What is the purpose of the
<!DOCTYPE html>declaration?Tells the browser to use the modern version of HTML (HTML5).
What is the proper structure of an HTML document?
<!DOCTYPE html>,<html>,<head>,<body>, and all visible elements inside<body>.How do you link an external CSS file to an HTML document?
Use a
<link>element withrel="stylesheet"andhref="filename.css"inside the<head>.What is a file path in HTML?
A way to locate a file relative to the current HTML file, e.g.,
images/photo.jpgmeans go into theimagesfolder.How do you load a Google Font onto a webpage?
Copy the
<link>tag from Google Fonts and paste it into the<head>section of your HTML.How do you display an image in HTML?
Use the
<img>element with asrcattribute pointing to the image file.How do you resize an image while keeping its aspect ratio?
Set only the
widthor theheightin CSS, and the other dimension adjusts automatically.What is the
object-fitproperty used for?Controls how an image fits its container, e.g.,
cover(crops to fill) orcontain(fits entirely).What are the three basic display types in CSS?
Block (takes full line), inline-block (only takes needed space, can sit beside others), and inline (within text).
How do you make a block element display beside another element?
Change its display to
inline-blockor useflex/gridon the parent.What is a
<div>element?A generic container that groups elements together; by default a block element.
What is the nested layouts technique?
Combining vertical and horizontal layouts (using blocks, inline-blocks, flexbox, or grid) to recreate complex designs.
How do you create a CSS Grid?
Set
display: grid;and define columns withgrid-template-columns, e.g.,100px 1fr 1fr.How do you add spacing between grid columns and rows?
Use
column-gapandrow-gapproperties.How do you create a Flexbox container?
Set
display: flex;on the parent element.How do you center items both horizontally and vertically in Flexbox?
Use
justify-content: center;andalign-items: center;on the flex container.How do you make a flex item take up remaining space?
Set
flex: 1;(or a positive number) on the item.How do you prevent a flex item from shrinking?
Set
flex-shrink: 0;on the item.What is the difference between CSS Grid and Flexbox?
Grid is two-dimensional and more rigid (define rows and columns); Flexbox is one-dimensional and flexible based on content size.
What does
position: fixed;do?Sticks an element to the browser viewport so it stays in place while scrolling.
What does
position: absolute;do?Positions an element relative to its nearest positioned ancestor (or the page if none exists).
What does
position: relative;do?Positions an element relative to its normal position; often used as an anchor for absolute positioning of child elements.
How do you create a tooltip that appears on hover?
Place a
position: absoluteelement inside aposition: relativeparent, setopacity: 0by default, and change toopacity: 1on hover using a pseudo-class.How do you create a notification badge on an icon?
Wrap the icon in a
position: relativecontainer, then add an absolute element withtopandrightset to position it in the corner.What is a media query in CSS?
A rule that applies styles only when certain conditions are met, e.g., screen size:
@media (max-width: 750px) { ... }.How do you write shorthand for
paddingin CSS?padding: top right bottom left;(clockwise). Two values: vertical horizontal. One value: all sides.How do you write shorthand for
margin?Same as padding shorthand:
margin: top right bottom left;What is CSS inheritance?
Some CSS properties (like
colorandfont-family) are automatically passed from parent to child elements.What are semantic HTML elements?
Elements that have meaning, such as
<header>,<nav>,<main>, and<section>.How do you write a comment in HTML?
<!-- comment text -->How do you write a comment in CSS?
/* comment text */

Ask anything
We've read this whole study set, so questions about it get the best answers.