This page has been robot translated, sorry for typos if any. Original content here.

Positioning and visualization of page elements

Positioning and visualization of page elements

Styles include the way the element is positioned using the positioning method. This method is based on specifying the specific coordinates for each element. In cascading style sheets, positioning is described by the position property, which has the following values:

  • absolute is the origin of the upper left corner.
  • retative - relative positioning, where "zero" is assigned according to the HTML code.
  • static - the location is invariable, relative to the values ​​of the HTML code.
  • fixed - fixing the element on the page (the element is not subject to the "elevator").

You can also change the position of an element in CSS by shifting it along the X axis (left property), along the Y axis (top property), and the Z axis (the z-index property determines the purpose of the layers). It is not advisable to create such styles separately from the tag, because each item's position is unique on the page. Example: <DIV style = "position: absolute; top: 200px; left: 160px; z-index: -1"> a page element </ DIV>.

Styles also allow you to add visualization effects to elements, ie to change their appearance and the way they are displayed on the screen. To change the transparency of the element, the visibility property is called and its visible value (the item is visible), hidder (the element is not visible), and collapse (hides text or table elements). The code is written like this: style = "visibility: _value " .

Images that need to be cropped are processed with the clip style property. The value of the latter is called rect. Numbers are assigned to it, which indicate which side and how much to trim the image. The principle is this:

STYLE = "clip: rect ( _top_right_bottom_left) , where _top and others are the numbers in px of the image truncation from each side and their sequence is unchanged.

The overtlow style property is responsible for visualizing the element in the specified area. Values:

  • auto - the appearance of scrolling, if the size of the element will be larger than the area.
  • scroll - the appearance of scrolling, regardless of the size of the elements and area.
  • hidder - the element is cropped around the border of the region.
  • visible - the element will be stretched or compressed to the limits of the region.

The display on the screen of the elements adjusts the display property and its values:

  • none - the item is not displayed.
  • block - the element is placed in a separate paragraph.
  • inline - insert text into the current paragraph.
  • list-item is a list item.
  • table - block table (applies only to the <TABLE> tag ).
  • inline-table - text table (applies only to the <TABLE> tag ).
  • table-cell - table cell (applies only to <TH> and <TD> tags).
  • table-column - column of the table (applies only to the <COL> tag ).
  • table-row - the row of the table (applies only to the <TABLE> tag ).
  • table-caption - block table (applies only to the <CAPTION> tag ).
  • table-row-group - a group of table rows (applies only to the <TBODY> tag ).
  • table-column-group - column table group (applies only to the <COLGROUP> tag ).
  • table-footer-group - group of table subheadings (applies only to the <THEAD> tag ).
  • table-header-group - group of table headers (applies only to the <THEAD> tag ).

Through styles, you can do the flow around elements. This is done using the float property, where the value left indicates flow from the left side, and right to the right. Similarly, the clear property (selecting the side of an element that can not be touched with the previous element) is applied. Example: IMG {clear: left} .

The task

Based on the above material, create a set of styles for tables . At the same time, to begin, dial the code manually , so remember the name of the properties and their values. Then you can use your knowledge in HTML-editors , where there are built-in tools for compiling cascading sheets of CSS styles.