CS 511-Web Engineering
Week 4
Topic 39-41
CS 511- Week 4:Topic 39-41 |
Topic 39:
Topic 40:
When it comes to image formats for the web, there are several options available, each with its own characteristics and best use cases.
JPEG (Joint Photographic Experts Group) or JPG is a popular file format for photographic images. It supports true-color images with 24-bit color depth, allowing for millions of colors. JPEG uses a lossy compression algorithm, which means that it reduces file size by selectively discarding some image data. While this compression results in a smaller file size, it can also lead to a loss of image quality, particularly if the image is heavily compressed. JPEG is well-suited for photographs and continuous-tone images that require a wide range of colors.
GIF (Graphic Interchange Format) was one of the earliest image formats supported by web browsers. GIF files are limited to 8-bit color depth, which allows for a maximum of 256 colors. GIF uses a lossless compression algorithm, preserving all image data and making it suitable for graphics with large areas of solid color or simple animations. Additionally, GIF supports transparency, allowing for parts of the image to be transparent or have a designated background color.
PNG (Portable Network Graphics) is a more recent image format that has gained popularity on the web. PNG supports both indexed color with up to 8 bits and true-color images with 24-bit color depth. It offers lossless compression, meaning no image data is discarded during compression. PNG also supports alpha channel transparency, allowing for more complex transparency effects. It is commonly used for images that require transparency, graphics with sharp edges, logos, and illustrations.
SVG (Scalable Vector Graphics) is a vector-based image format that uses XML markup to define shapes, lines, curves, and colors. Unlike raster-based formats, SVG images are not composed of pixels but rather mathematical descriptions of objects. SVG is commonly used for logos, icons, and graphics that require scalability.
In addition to these formats, there are other image formats used in specific contexts.
For example, the TIFF (Tagged Image File Format) is a versatile format often used in professional printing. TIFF supports lossless compression, multiple color depths, transparency, layers, and other features relevant to print professionals.
Choosing the right image format for the web depends on the specific requirements of the image and the intended use. Factors to consider include the type of image (photograph, graphic, logo), desired quality, file size limitations, need for transparency, and scalability requirements.
Topic 41:
To understand CSS positioning and layout, it is important to grasp the concept of normal flow in HTML and how block-level and inline elements are displayed by default in a browser.
Block-level elements, such as <p>, <div>, <h2>, <ul>, and <table>, are rendered as individual blocks on their own line. Each block-level element begins on a new line, and by default, there can only be one block-level element per line. These elements follow the normal CSS box model, meaning they can have margins, padding, background colors, and borders applied to them. They take up the full width available within their containing element by default, unless modified by CSS properties or layout rules.
On the other hand, inline elements do not form their own blocks but are displayed within lines of text or other inline elements. Normal text within an HTML document is considered inline, as well as elements like <em>, <a>, <img>, and <span>. Inline elements flow within the content of a block-level element or other inline elements. They do not cause line breaks and are rendered adjacent to one another, from left to right, until they reach the end of the line. If the available width is insufficient, the browser wraps the content to the next line.
Inline elements typically do not have margins, padding, or explicit width and height properties by default, as their dimensions are determined by their content.
Understanding normal flow is crucial because it forms the foundation for CSS positioning and layout. By default, block-level and inline elements are displayed in a predictable manner, with block-level elements taking up their own lines and inline elements flowing within those lines. CSS positioning and layout techniques can then be applied to modify and control the placement, size, and behavior of elements on the page beyond the normal flow.
Assessment:
Answer: b) HTML patterns for representing common information
Which microformat is used to mark up contact information?
Answer: a) hCard
What is the purpose of using microformats?
Answer: b) Enhance the accessibility and data extraction
Which image format is commonly used for photographs and continuous-tone images?
Answer: a) JPEG
Which image format supports transparency and simple animations?
Answer: b) GIF
What is a key advantage of using SVG image format?
Answer: b) Scalability without loss of quality
How are block-level elements displayed by default?
Answer: b) Each on its own line
Which type of elements can be considered inline?
Answer: b) <em> and <span>
What determines the dimensions of inline elements?
Answer: c) The content within the element
Why is understanding normal flow important in CSS positioning and layout?
Answer: c) It provides the foundation for element placement and behaviour
0 Comments