Computer Science, asked by shailajanitika025, 7 months ago

Observe the code given below and answer the questions: body {text-align:center; font-size:16px; color:blue} Main heading Paragraph text a. Which CSS styling has been used? b. What all elements are there in the web page? c. What will be the output of the web page? (describe it)

Answers

Answered by khanzaid01
1

Alignment, font styles, and horizontal rules in HTML documents

This section of the specification discusses some HTML elements and attributes that may be used for visual formatting of elements. Many of them are deprecated.

15.1 Formatting

15.1.1 Background color

Attribute definitions

Deprecated. This attribute sets the background color for the document body or table cells.

This attribute sets the background color of the canvas for the document body (the BODY element) or for tables (the TABLE, TR, TH, and TD elements). Additional attributes for specifying text color can be used with the BODY element.

This attribute has been deprecated in favor of style sheets for specifying background color information.

15.1.2 Alignment

It is possible to align block elements (tables, images, objects, paragraphs, etc.) on the canvas with the align element. Although this attribute may be set for many HTML elements, its range of possible values sometimes differs from element to element. Here we only discuss the meaning of the align attribute for text.

Attribute definitions

Deprecated. This attribute specifies the horizontal alignment of its element with respect to the surrounding context. Possible values:

left: text lines are rendered flush left.

center: text lines are centered.

right: text lines are rendered flush right.

justify: text lines are justified to both margins.

The default depends on the base text direction. For left to right text, the default is align=left, while for right to left text, the default is align=right.

DEPRECATED EXAMPLE:

This example centers a heading on the canvas.

<H1 align="center"> How to Carve Wood </H1>

Using CSS, for example, you could achieve the same effect as follows:

<HEAD>

<TITLE>How to Carve Wood</TITLE>

<STYLE type="text/css">

H1 { text-align: center}

</STYLE>

<BODY>

<H1> How to Carve Wood </H1>

Note that this would center all H1 declarations. You could reduce the scope of the style by setting the class attribute on the element:

<HEAD>

<TITLE>How to Carve Wood</TITLE>

<STYLE type="text/css">

H1.wood {text-align: center}

</STYLE>

<BODY>

<H1 class="wood"> How to Carve Wood </H1>

DEPRECATED EXAMPLE:

Similarly, to right align a paragraph on the canvas with HTML's align attribute you could have:

<P align="right">...Lots of paragraph text...

which, with CSS, would be:

<HEAD>

<TITLE>How to Carve Wood</TITLE>

<STYLE type="text/css">

P.mypar {text-align: right}

</STYLE>

<BODY>

<P class="mypar">...Lots of paragraph text...

DEPRECATED EXAMPLE:

To right align a series of paragraphs, group them with the DIV element:

<DIV align="right">

<P>...text in first paragraph...

<P>...text in second paragraph...

<P>...text in third paragraph...

</DIV>

With CSS, the text-align property is inherited from the parent element, you can therefore use:

<HEAD>

<TITLE>How to Carve Wood</TITLE>

<STYLE type="text/css">

DIV.mypars {text-align: right}

</STYLE>

<BODY>

<DIV class="mypars">

<P>...text in first paragraph...

<P>...text in second paragraph...

<P>...text in third paragraph...

</DIV>

To center the entire document with CSS:

</BODY>

15.2 Fonts

The following HTML elements specify font information. Although they are not all deprecated, their use is discouraged in favor of style sheets.

Rendering of font style elements depends on the user agent. The following is an informative description only.

TT: Renders as teletype or monospaced text.

I: Renders as italic text style.

B: Renders as bold text style.

BIG: Renders text in a "large" font.

SMALL: Renders text in a "small" font.

STRIKE and S: Deprecated. Render strike-through style text.

U: Deprecated. Renders underlined text.

The following sentence shows several types of text:

<P><b>bold</b>,

<i>italic</i>, <b><i>bold italic</i></b>, <tt>teletype text</tt>, and

<big>big</big> and <small>small</small> text.

These words might be rendered as follows:

An example of rendering of various font styles

It is possible to achieve a much richer variety of font effects using style sheets. To specify blue, italic text in a paragraph with CSS:

<HEAD>

<STYLE type="text/css">

P.mypar {font-style: italic; color: blue}

</STYLE>

</HEAD>

<P id="mypar">...Lots of blue italic text...

Font style elements must be properly nested. Rendering of nested font style elements depends on the user agent.

The FONT element changes the font size and color for text in its contents.

The BASEFONT element sets the base font size (using the size attribute). Font size changes achieved with FONT are relative to the base font size set by BASEFONT. If BASEFONT is not used, the default base font size is 3.

:

Similar questions