HTML & CSS Flashcards
What is the documentation type declaration for HTML5 ?
<!DOCTYPE html>
What is DOM?
DOM aka document object model is the tree-like structure describing how the HTML elements are related.
What is the use <head> element ?
The <head> element is a container for metadata (data about data) and is placed between the <html> tag and the <body> tag. Metadata is data about the HTML document. Metadata is not displayed. Metadata typically defines the document title, character set, styles, scripts, and other meta information.
What are HTML attributes?
Attributes provide additional information about elements. It is a piece of markup language used to adjust the behavior or display of an HTML element. For example, attributes can be used to change the color, size, or functionality of HTML elements.
How to represent comments in HTML?
<!-- type comment here -->
gives us a comment in HTML.
How to write HTML elements?
<tagname> Content goes here... </tagname>
What is <br></br> tag?
It can be used in between elements for a line break, which is nothing but a blank self-closing element
What is href attribute?
The <a> tag defines a hyperlink. The href attribute specifies the URL of the page the link goes to.</a>
eg:
<a> Takes to styles page </a>
Define src Attribute.
The <img></img> tag is used to embed an image in an HTML page. The src attribute specifies the path to the image to be displayed. It is a self closing element.
eg:
<img></img>
What are two ways to specify the URL in the src attribute?
- Absolute URL: Links to an external image that is hosted on another website.
eg:
<img></img> - Relative URL: Links to an image that is hosted within the website. Here, the URL does not include the domain name. If the URL begins without a slash, it will be relative to the current page. Example: src=”img_girl.jpg”. If the URL begins with a slash, it will be relative to the domain. Example: src=”/images/img_girl.jpg”.
What is the alt Attribute?
The required alt attribute for the <img></img> tag specifies an alternate text for an image, if the image for some reason cannot be displayed. This can be due to a slow connection, or an error in the src attribute, or if the user uses a screen reader.
eg:
<img></img>
What is the title Attribute?
The title attribute defines some extra information about an element. The value of the title attribute will be displayed as a tooltip when you mouse over the element.
eg:
<p>This is a paragraph.</p>
What are HTML headings?
HTML headings are titles and subtitles that you want to display on a webpage.
It’s size ranges from <h1> to <h6>
HEADINGS ARE VERY IMPORTANT!!!!!!
Search engines use the headings to index the structure and content of your web pages.
Users often skim a page by its headings. It is important to use headings to show the document structure.
<h1> headings should be used for main headings, followed by <h2> headings, then the less important <h3>, and so on.
Note: Use HTML headings for headings only. Don't use headings to make text BIG or bold.
</h3></h2></h1>
HTML Paragraphs and Displays
The HTML <p> element defines a paragraph.
A paragraph always starts on a new line, and browsers automatically add some white space (a margin) before and after a paragraph.
With HTML, you cannot change the display by adding extra spaces or extra lines in your HTML code.
The browser will automatically remove any extra spaces and lines when the page is displayed.
What is HTML horizontal rules?
The <hr> tag defines a thematic break in an HTML page, and is most often displayed as a horizontal rule.
The <hr> tag is an empty tag, which means that it has no end tag.
How to have a passage displayed with space and other lines like a poem?
The HTML <pre> element defines preformatted text.
The text inside a <pre> element is displayed in a fixed-width font (usually Courier), and it preserves both spaces and line breaks.
eg:
<pre>
My Bonnie lies over the ocean.
My Bonnie lies over the sea.
My Bonnie lies over the ocean.
Oh, bring back my Bonnie to me.
</pre>
What is HTML style?
The HTML style attribute is used to add styles to an element, such as color, font, size, and more.
<tagname>
</tagname>
What is CSS background-color property defines the background color for an HTML element ?
The CSS background-color property defines the background color for an HTML element.
eg:
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
Text Color in HTML
The CSS color property defines the text color for an HTML element.
eg:
<h1>This is a heading</h1>
Fonts in CSS
The CSS font-family property defines the font to be used for an HTML element