The CSS Box Model
The CSS Box Model
<div id="contentinfo">
<p>Welcome to our website. We provide tutorials on various subjects.</p>
</div>
-------------------------------------------------------------------------------------------------------------------------
The main benefit in CSS, is that it manages to separate the style from the
content on your web page.
- You may want to change the way the HTML output looks. The best way to
do that is with a Cascading Style Sheet (CSS), Font family, type size,
colors,and other styles can be controlled with CSS for each kind of element .
The CSS Box Model
CSS, "box model" is used for designing and layout.
The CSS box model is a box that wraps around every HTML element. It consists
of: margins, borders, padding, and the actual content.
Margin
Border
padding
content
Explanation of the different parts:
Content - The content of the box, where text and images appear
Padding - Clears an area around the content. The padding is transparent
Border - A border that surrounds the padding and content
Margin - Clears an area outside the border. The margin is transparent
The box model allows us to add a border around elements, and to define space
between elements.
Example
div {
width: 300px;
border: 25px solid green;
padding: 25px;
margin: 25px;
}
Total element width = width + left padding + right padding + left border + right
border + left margin + right margin
Total element height = height + top padding + bottom padding + top border +
bottom border + top margin + bottom margin
--------------------------------------------------------------
---------------------------------------------------------------
HTTP (Hypertext Transfer Protocol) is the set of rules for transferring files
(text, graphic images, sound, video, and other multimedia files) on the World
Wide Web. HTTP is an application protocol that runs on top of
the TCP/IP suite of protocols
Parameters remain in browser history because they are part of the Parameters are not
URL saved in browser
history.
GET requests are re-executed but may The browser usually alerts the
not be re-submitted to server if the HTML user that data will need to be
is stored in the browser cache. re-submitted.
GET method should not be used when sending POST method used when
passwords or sensitive information. sending passwords or other
sensitive information.
Image map lets you link to many different web pages using a single image. You can
define shapes in images that you want to make part of an image mapping
No, hyperlinks can be used on text as well as images. That means you can convert
an image into a link that will allow user to link to another page when clicked. Just
surround the image within the <a href=” “>…</a> tag combinations.
When you use image maps, it can easily become confusing and difficult to determine
which hotspots corresponds with which links. Using alternative text lets you put a
descriptive text on each hotspot link.
Style sheets enable you to build consistent, transportable, and well-defined style
templates. These templates can be linked to several different web pages, making it
easy to maintain and change the look and feel of all the web pages within a site.
With ordered lists, you can select to use a number of different list types including
alphabetical and Roman numerals. The type attribute for unordered lists can be set
to disc, square, or circle.
What other ways can be used to align images and wrap text?
Tables can be used to position text and images. Another useful way to wrap text
around an image is to use style sheets.
What is a marquee?
A marquee allows you to put a scrolling text in a web page. To do this, place
whatever text you want to appear scrolling within the <marquee> and </marquee>
tags.
The bullet color is always the same as that of the first character in the list litem. If you
surround the <li> and the first character with a set of <font> tags with the color
attribute set, the bullet color and the first character will be a different color from the
text.
How do you create a text on a webpage that will allow you to send an email when
clicked?
To change a text into a clickable link to send email, use the mailto command within
the href tag.
The default color for normal and active links is blue. Some browsers recognize an
active link when the mouse cursor is placed over that link; others recognize active
links when the link has the focus. Those that don’t have a mouse cursor over that
link is considered a normal link.
If you try to open the external CSS file in a browser, the browser cannot open the
file, because the file has a different extension. The only way to use an external CSS
file is to reference it using <link/> tag within another html document.