To come in
All computer secrets for beginners and professionals
  • Introduction to Scalable Vector Graphics (SVG)
  • Reminder for using BB codes (bbCode) Connecting a code execution script
  • Easy Hack: How to extract data through Cross Site Scripting Inclusion This is an xss attack
  • HTML character codes Plugins for displaying code on the post page
  • Special characters HTML Html css symbols
  • Responsive menu without Javascript Default: from align-items container
  • What tag defines a numbered list. Bulleted list. Bulleted Lists in HTML

    What tag defines a numbered list.  Bulleted list.  Bulleted Lists in HTML

    A bulleted list is defined by adding a small bullet, usually in the form of a filled circle, before each list item. The list itself is formed using a container

      , and each list item begins with a tag
    • as shown below.

      • First point
      • Second point
      • Third point

      The list must contain a closing tag

    , otherwise an error will occur. Closing tag Although not required, we always recommend adding it to clearly separate list items.

    Example 11.1 shows the HTML code for adding a bulleted list to a web page.

    Example 11.1. Create a bulleted list

    Bulleted list


    • Cheburashka
    • Crocodile Gena
    • Shapoklyak
    • Rat Larisa

    The result of this example is shown in Fig. 11.1.

    Rice. 11.1. Bulleted list view

    Pay attention to the padding at the top, bottom, and left of the list. Such indents are added automatically.

    Markers can take one of three forms: circle (default), circle, and square. To select a marker style, use the tag's type attribute

      . Acceptable values ​​are given in table. 11.1

      Table 11.1. List Bullet Styles
      List type HTML Code Example
      List with circle markers

      • First
      • Second
      • Third
      List with circle bullets

      • First
      • Second
      • Third
      List with square bullets

      • First
      • Second
      • Third

      The appearance of markers may vary slightly in different browsers, as well as when changing the font and text size.

      Creating a list with square bullets is shown in Example 11.2.

      Example 11.2. Type of markers

      Bulleted list

      Changing Beliefs

      • change in religious faith (optional: Buddhism, Confucianism, Hinduism). Special offer - Judaism and Islam together;
      • a change in belief in the infallibility of the favorite party;
      • the belief that aliens exist;
      • preference for a political system as the best of its kind (to choose from: feudalism, socialism, communism, capitalism).

      The result of this example is shown in Fig. 11.2.

      Lists are part of everyday life. The to-do list defines what is done. Navigation routes offer a step-by-step list of directions. Recipes require a list of ingredients and a list of instructions. Lists are found almost everywhere, so it's easy to see why they are also popular on the Internet.

      When we want to use a list on a website, HTML offers three different types to choose from: bulleted, numbered, and description list. Which type of list to use, and whether to use a list at all, depends on the content and the semantically most appropriate option for displaying it.

      In addition to the three different types of lists available in HTML, there are several ways to style these lists via CSS. For example, we can choose what type of bullet to specify for the list. The marker may be a square, a circle, a number, a letter, or possibly none. In addition, we can decide how the list should be displayed - vertically or horizontally. All of these options play an important role in styling our web pages.

      Bulleted lists

      A bulleted or unordered list is simply a list of related items for which the order does not matter. Creating a bulleted list in HTML is done using a block list element

        . Each individual item in the list is marked with an element
      • .

        By default, most browsers add vertical margin and left padding to the element

          , and before each element
        • puts a single-color point. This point is called a list marker and can be changed using CSS.

          • Orange
          • Green
          • Blue

          Show bulleted list

          Numbered lists

          Numbered or ordered list of items

            Very similar to a bulleted list, individual bullet points are created in the same way. The main difference between lists is that for an ordered list, the order in which the items are presented matters.

            Because order matters, a numbered list uses numbers instead of a period as the default bullet.

            1. Walk along Apricot Street
            2. Turn onto Vinogradnaya

            Numbered list demonstration

            Numbered lists also have unique attributes available to them, including start and reversed.

            start attribute

            The start attribute specifies the number at which the numbered list should begin. By default, lists start at 1, but there may be situations where the list should start at 30 or some other number. When we use the start attribute on an element

              , then we can accurately determine from which number the counting of the numbered list should begin.

              The start attribute accepts only integer values, although numbered lists may use different numbering systems, such as Roman numerals.

              1. Walk along Apricot Street
              2. Turn onto Vinogradnaya
              3. Stop on Shady Street

              Demonstration of the start attribute

              reversed attribute

              The reversed attribute when added to an element

                allows the list to be displayed in reverse order. A list of five items numbered 1 to 5 can be reversed and numbered 5 to 1.

                The reversed attribute is a Boolean attribute and as such it does not take on any value. It can be true or false. False is the default value, the value becomes true when the reversed attribute appears on the element

                  .

                  1. Walk along Apricot Street
                  2. Turn onto Vinogradnaya
                  3. Stop on Shady Street

                  Demonstration of the reversed attribute

                  value attribute

                  The value attribute can be applied to individual elements

                1. in a numbered list to change its value in the list. The number of any list item that appears below a list item with a value attribute will be recalculated accordingly.

                  As an example, if the second list item has a value attribute set to 9, the number of that list item will be output as if it were the ninth one. All subsequent list items will be numbered starting from 9.

                  1. Walk along Apricot Street
                  2. Turn onto Vinogradnaya
                  3. Stop on Shady Street

                  Value attribute demonstration

                  Description Lists

                  Another type of list you'll see online (but not as often as bulleted or numbered lists) is a list of descriptions. Such lists are used to identify several terms and their descriptions, as in a glossary, for example.

                  Creating a description list in HTML is done using a block element

                  . Instead of using element
                2. To mark up list items, a description list requires two block elements:
                  for the term and
                  for description.

                  A description list can contain many terms and descriptions, one after another. In addition, such a list may contain several terms per description, as well as several descriptions per term. A single term can have multiple meanings and be subject to multiple descriptions. Conversely, one description may fit several terms.

                  When adding a description list element

                  must go to the element
                  . The term and the description that immediately follows it are related to each other. Therefore, the order of these elements is important.

                  By default, element

                  includes vertical padding, like elements
                    And
                      . In addition, the element
                      includes the left margin by default.

                      studies
                      Devoting time and attention to gaining knowledge of the subject being taught, especially through books.
                      project
                      A submitted plan or drawing that shows how a building, clothing, or other item will look and function before it is built or made.
                      Existing goals, plans, or intentions before they are embodied or realized in a tangible object.
                      business
                      Job
                      A person's regular occupation, profession or craft.

                      Description List Demonstration

                      Nested Lists

                      The feature that makes lists very powerful is the nesting feature. Each list can be nested within another list and they can be nested multiple times. But the ability to nest lists endlessly does not give you the freedom to do so. Lists should be reserved specifically where they retain the most semantic meaning.

                      The trick to nesting lists is to know where each list and list item begins and ends. Speaking specifically about bulleted and numbered lists, the only element that can appear directly inside

                        And
                          is an element
                        1. . Let's repeat - the only element that we can put as a direct descendant of the elements
                            And
                              , is
                            1. .

                              However, inside the element

                            2. a standard set of elements can be added, including any elements
                                or
                                  .

                                  To nest a list, start a new list before closing the list item. Once the nested list is complete and closed, close the enclosing list item and continue with the original list.

                                  1. Walk the dog
                                  2. Fold laundry
                                  3. Go to the store and buy:
                                    • Milk
                                    • Bread
                                    • Cheese
                                  4. Mow the lawn
                                  5. Cook dinner

                                  Demonstration of nested lists

                                  Since nested lists can be a bit confusing and display unwanted styles if done incorrectly - let's take a quick look at them. Elements

                                    And
                                      can only contain elements
                                    1. . Element
                                    2. can contain any regular element you want. However, the element
                                    3. must be a direct descendant of either element
                                        , or
                                          .

                                          It's also worth noting that when lists are nested inside other lists, their markers will change depending on the depth of the nesting. In the previous example, a bulleted list nested within a numbered list uses a circle instead of a dot as markers. This change occurs because the bulleted list is nested one level inside the numbered list.

                                          Luckily, we can control how bullet points look at any level, which we'll look at next.

                                          Styling List Items

                                          Bulleted and numbered lists use list item bullets by default. For bulleted lists these tend to be solid colored dots, while for numbered lists these tend to be numbers. Using CSS, the style and position of these markers can be customized.

                                          list-style-type property

                                          The list-style-type property is used to set the contents of the list item marker. Available values ​​range from squares and decimals to Armenian numbering and CSS styling can be added to elements

                                            ,
                                              or
                                            1. .

                                              Any value for the list-style-type property can be added to a bulleted or numbered list. With this in mind, you can use numbering in a bulleted list and non-numeric bullets in a numbered list.

                                              • Orange
                                              • Green
                                              • Blue

                                              Ul ( list-style-type: square; )

                                              Demonstration of the list-style-type property

                                              list-style-type values

                                              As mentioned earlier, the list-style-type property contains a handful of different values. The following table shows these values ​​and their corresponding contents.

                                              Using an Image as a List Marker

                                              There may come a time when the default values ​​for the list-style-type property are not enough and we want to define our own list marker. This is most often done by placing a background image for each element.

                                            2. .

                                              The process involves removing any default list-style-type property value and adding a background image and margins to the element

                                            3. .

                                              More details - setting the list-style-type property to none will remove existing list markers. The background property will set the background image along with its position and repeat if necessary. And the padding property will provide space to the left of the text for the background image.

                                              • Orange
                                              • Green
                                              • Blue

                                              Li ( background: url("arrow.png") 0 50% no-repeat; list-style-type: none; padding-left: 12px; )

                                              Showing an Image as a Marker

                                              list-style-position property

                                              By default, list bullets are positioned to the left of the content in the element

                                            4. . This positioning style is described as outside , which means that all content will appear directly to the right, outside the list marker. With the list-style-position property we can change the default value of outside to inside or inherit .

                                              outside places the list marker to the left of the element

                                            5. and do not allow any content to flow below this marker. The inside value (which is rarely used and can be seen) places the list marker on the first line of the element
                                            6. and allows the content to wrap around the marker if necessary.

                                              • Cupcakes...
                                              • Sprinkling...

                                              Ul ( list-style-position: inside; )

                                              List-style-position property demonstration

                                              Generic property list-style

                                              The list properties we recently discussed, list-style-type and list-style-position , can be combined into one generic property, list-style . In this property, we can use one or all of the list property values ​​at the same time. The order of these values ​​should be: list-style-type followed by list-style-position .

                                              Ul ( list-style: circle inside; ) ol ( list-style: lower-roman; )

                                              Horizontal list display

                                              Sometimes we want to display lists horizontally rather than vertically. Perhaps we want to divide the list into several columns to build a navigation list or place several list items in one row. Depending on the content and desired appearance, there are several ways to display lists as a single line, for example by taking the display property value of the elements

                                            7. like inline or inline-block or via the float property.

                                              List display

                                              The fastest way to display a list on one line is to give the elements

                                            8. display property with the value inline or inline-block . This will put all the elements
                                            9. on one line with equal spacing between each list item.

                                              If the spaces between elements

                                            10. are causing problems, they can be removed using the same techniques we discussed in Lesson 5, Positioning Content.

                                              Much more often we will use the inline-block value instead of the inline value. The inline-block value makes it easy to add vertical padding and other space to elements

                                            11. , while the inline value does not.

                                              When the value of the display property is changed to inline or inline-block , the list marker, whether a dot, number, or other, is removed.

                                              • Orange
                                              • Green
                                              • Blue

                                              Li ( display: inline-block; margin: 0 10px; )

                                              Demonstration of a list with inline-block

                                              Lists with float

                                              Changing the display property to inline or inline-block is quick, but it removes the list markers. If they are needed then adding a float to each element

                                            12. is a better option than changing the display property.

                                              Installation for all elements

                                            13. float properties like left will align all elements horizontally
                                            14. directly next to each other without any gaps between them. When we use float for
                                            15. , the list marker is displayed by default and will be positioned on top of the item
                                            16. next to him. To prevent the list marker from appearing on top of other items
                                            17. , horizontal margin or padding must be added.

                                              • Orange
                                              • Green
                                              • Blue

                                              Li ( float: left; margin: 0 20px; )

                                              Demonstration of a list with float

                                              As with any floated elements, this breaks the flow of the page. We must not forget to clear the float and return the page to normal flow - the most common method is via clearfix.

                                              Navigation list example

                                              We often design and find navigation menus that use unordered lists. These lists are typically laid out horizontally using one of the two methods mentioned earlier. Here, for example, is a horizontal navigation menu laid out using an unordered list, in which the elements

                                            18. are displayed as inline-block .

                                              Navigation ul ( font: bold 11px "Helvetica Neue", Helvetica, Arial, sans-serif; margin: 0; padding: 0; text-transform: uppercase; ) .navigation li ( display: inline-block; ) .navigation a ( background: #395870; background: linear-gradient(#49708f, #293f50); border-right: 1px solid rgba(0, 0, 0, .3); color: #fff; padding: 12px 20px; text-decoration: none; ) .navigation a:hover ( background: #314b60; box-shadow: inset 0 0 10px 1px rgba(0, 0, 0, .3); ) .navigation li:first-child a ( border-radius: 4px 0 0 4px; ) .navigation li:last-child a ( border-right: 0; border-radius: 0 4px 4px 0; )

                                              Navigation List Demonstration

                                              On practice

                                              Now that we know how to create lists in HTML and CSS, let's take a look at our Styles Conference site and see where we could use lists.

                                                Now navigation menus in elements

                                                And
                                                on our pages consist of several links. These elements can be better organized as an unordered list.

                                                Using an unordered list (via element

                                                  ) and list items (via the element
                                                • ) will set the structure of our navigation menus. These new elements, however, will render our navigation menus vertically.

                                                  We're going to change the display value for our elements

                                                • to inline-block so that they all line up horizontally. When we do this, we must also take into account the empty space on the left between each element
                                                • . Recalling from Lesson 5, Positioning Content, we know that opening an HTML comment at the end of an element
                                                • and closing the comment at the beginning of the element
                                                • will remove this space.

                                                  With that in mind, the markup for the navigation menu inside our element

                                                  will look like this:

                                                  In the same vein, markup for the navigation menu inside our element

                                                  will look like this:

                                                  Don't forget to make these changes to all our HTML files.

                                                  With our bulleted list, let's make sure the list items are aligned horizontally and clean up their styles a bit. We'll use the existing nav class to specify our new styles.

                                                  Let's start by making sure that all the elements

                                                • inside any element with a nav class attribute value were rendered as inline-block to enable horizontal margins and to allow elements to be aligned vertically.

                                                  Additionally, we will use the :last-child pseudo-class to determine the last element

                                                • and reset its right margin to 0. This ensures that any horizontal space between elements
                                                • and the edge of its parent will disappear.

                                                  In our main.css file, below the navigation styles, add the following CSS:

                                                  Nav li ( display: inline-block; margin: 0 10px; vertical-align: top; ) .nav li:last-child ( margin-right: 0; )

                                                  You're probably wondering why our list doesn't include any list bullets or styles by default. These styles were removed by resetting at the top of our style. If we look at the reset, we see that the elements

                                                    ,
                                                      And
                                                    • include zero margin and padding, and for
                                                        And
                                                          list-style is set to none .

                                                          The navigation menu isn't the only place we'll use lists. We will also use them on some of our internal pages, including the Speakers page. Let's add some speakers to our conference.

                                                          In the speakers.html file, just below the intro section, we will create a new section where we will introduce all our speakers. By reusing some existing styles we will use the element

                                                          with a row class to wrap all our speakers and apply a white background and margins behind them. Inside an element
                                                          we will add an element
                                                          with the grid class to center our speakers on the page and this will allow us to include multiple columns as well.

                                                          So far our HTML below the intro section looks like this:

                                                          Inside the grid, each speaker will be marked with its own element

                                                          , which includes two columns. The first column measures two-thirds of the element
                                                          and will be marked with element
                                                          . The second column measures the remaining third of the element
                                                          and will be marked using the element

                                                      Our navigation menu is now complete and the Speakers page has begun to take shape.

                                                      Rice. 8.01. Our Speakers page after updating the navigation menus and adding a column

                                                      Demo and source code

                                                      Below you can view the Styles Conference website in its current state, as well as download the site's current source code.

                                                      Summary

                                                      Lists are used quite often in HTML, often in places that are not explicit or obvious. The key is to use them semantically as much as possible and where they fit best.

                                                      To summarize, in this lesson we covered the following:

                                                      • how to create a bulleted, numbered, and descriptive list;
                                                      • Editors: Vlad Merzhevich

                                                      - 4.5 out of 5 based on 2 votes

                                                      Very often, certain information on a website needs to be presented in the form of lists.

                                                      Lists allow you to organize and systematize various information and present it to the visitor in a convenient form.

                                                      Lists in HTML come in three varieties: bulleted lists, numbered lists, and definition lists. Let's look at how to create them in order.

                                                      Bulleted list.

                                                      This type of list is used most often. Bulleted list in HTML is created using tags

                                                      • . In this case, a marker is added opposite each list item; by default, it is a marker in the form of a circle. Using tags, a container is created, inside of which the list elements are located: .

                                                        The bulleted list code will look like this:

                                                        • This option is
                                                        • This option
                                                        • Option like this

                                                        You can try to create an HTML page using this code for you too, the result will be the following list:

                                                        As you can see, each list element is placed on a new line, with certain indents being created on the left, top and bottom. Each list item begins with a marker; the marker can be a filled circle (used by default), a circle, or a square. At the tag

                                                          There is a type attribute, which is used to set the style of the marker. This attribute has the following meanings:

                                                          • disc - circle;
                                                          • circle - circle;
                                                          • square - square.

                                                          The disc value is the default.

                                                          An example of creating a bulleted list with circle markers:

                                                          • This option is
                                                          • This option
                                                          • Option like this

                                                          As a result, the list will take the following form:

                                                          Creating a bulleted list with square markers:

                                                          • This option is
                                                          • This option
                                                          • Option like this

                                                          The list will look like:

                                                          The type attribute can be applied to more than just a tag

                                                            , but also to the tag
                                                          • . This way you can create a list with a variety of bullets.

                                                            • This option is
                                                            • This option
                                                            • Option like this

                                                            The result will be the following:

                                                            Numbered lists.

                                                            Numbered lists in HTML are lists in which each item has a serial number; numbered lists are created using a tag

                                                              and nested in its tags
                                                              1. First line
                                                              2. Second line
                                                              3. Third line

                                                              The list looks like this:

                                                              By default, numbering is in Arabic numerals. But the tag

                                                                There is a type attribute, using the values ​​of which you can make numbering in uppercase (type="A") or lowercase (type="a") in Latin letters, Roman numerals in the upper (type="I") and lower (type="i" ) register.

                                                                Below are abbreviated versions of the code and the type of numbering that may be in one case or another.

                                                                List view:

                                                                List view:

                                                                Numbering in lowercase letters of the Latin alphabet:

                                                                List view:

                                                                List view:

                                                                List view:

                                                                List of definitions in HTML.

                                                                A special type of list is definition lists. They differ in that each list element consists of two elements, a term and text that reveals its meaning. These lists are created using tags

                                                                . Tag
                                                                creates a container for the list, tag
                                                                sets the term and the tag
                                                                description or definition of a term.

                                                                This list is written as follows:

                                                                Term 1
                                                                Definition 1
                                                                Term 2
                                                                Definition of term 2
                                                                Term 3
                                                                Definition 3

                                                                The result will be the following list:

                                                                As you can see, this creates appropriate indentation for the term and definition text.

                                                                Nested or multi-level lists in HTML.

                                                                Sometimes it is necessary to nest another list within one element of a certain type of list. HTML allows you to unlimitedly embed some lists into elements of other lists.

                                                                For example, here's code that nests numbered lists within bulleted list items.

                                                                • This option is
                                                                  1. First line
                                                                  2. Second line
                                                                  3. Third line
                                                                • This option
                                                                  1. First line
                                                                  2. Second line
                                                                  3. Third line
                                                                • Option like this
                                                                  1. First line
                                                                  2. Second line
                                                                  3. Third line

                                                                HTML provides a special set of tags for presenting information in the form of lists. Lists are one of the most commonly used forms of data presentation, both in electronic and printed documents. We come across lists almost every day - it could be a list of necessary purchases in a store, students in class, or simply things that need to be done. The ability to organize list structures is available in many text editors, in particular, the powerful word processor Microsoft Word has convenient tools for formatting lists of various types (the possibilities of creating HTML lists using Microsoft Word are discussed in Chapter 8). Here are a number of cases for which the use of lists is quite convenient:

                                                                • Combining pieces of information into a single structure to create a readable appearance.
                                                                • Description of complex step-by-step processes.
                                                                • An arrangement of information in a table of contents style, with paragraphs pointing to relevant sections of the document.

                                                                Note that the above points are precisely organized in the form of a list structure.

                                                                HTML provides the following main types of lists: bulleted, numbered, and definition list. The following tags are used to implement lists of various types:

                                                                  ,
                                                                    ,
                                                                    , , . Using various types of lists built into a document, a variety of possibilities can be realized, the description of which is the subject of this chapter. The features of constructing lists of various types, as well as the use of nested lists are considered.

                                                                    Bulleted list

                                                                    One of the types of lists implemented in HTML is the bulleted list. Otherwise, lists of this type are called unnumbered or

                                                                    disordered. The last name is often used as a formal translation of the name of the corresponding tag

                                                                      , with the help of which lists of this type are organized in HTML documents (UL - Unordered List, unordered list).

                                                                      In a bulleted list, special characters called list markers are used to highlight its elements (they are often called bullets, which is the formal pronunciation of the English term bullet). The appearance of list markers is determined by the browser, and when creating nested lists, browsers automatically diversify the appearance of markers at different nesting levels.

                                                                      Tags

                                                                        And<LI >

                                                                        To create a bulleted list, you must use a container tag, inside which all the elements of the list are located. The opening and closing list tags provide a line break before and after the list, thus separating the list from the main content of the document, so there is no need to use paragraph tags here


                                                                        .

                                                                        Each list element must begin with a tag

                                                                      • (LI - List Item, list element). Tag
                                                                      • does not require a corresponding closing tag, although its presence is not prohibited in principle. Browsers usually start each new list item on a new line when displaying a document.

                                                                        The information provided is sufficient to construct a basic bulleted list. Let's give an example of an HTML document using a bulleted list, the display of which by the browser is shown in Fig. 2.1.

                                                                        Bulleted list example

                                                                          Zodiac signs:

                                                                          • Aries

                                                                          • Taurus

                                                                          • Twins

                                                                          • Cancer

                                                                          • a lion

                                                                          • Virgo

                                                                          • Scales

                                                                          • Scorpion

                                                                          • Sagittarius

                                                                          • Capricorn

                                                                          • Aquarius

                                                                          • Fish

                                                                        Rice. 2.1. Browser display of bulleted list

                                                                        Note that in addition to the list elements marked with the tag

                                                                      • , other HTML elements may be present. In the example above, one of these elements is plain text, which is not a list item, but acts as its title.

                                                                        Note

                                                                        Some textbooks on the HTML language indicate that a container tag should be used to set the title of the list. (LH - List Header, list header). This tag is currently not recognized by any common browsers and is not part of the HTML specification. Thus, its use becomes pointless, although it will not lead to any errors.

                                                                        In the tag

                                                                          two parameters can be specified: COMPACT and TYPE.

                                                                          The COMPACT parameter is written without a value and is used to indicate to the browser that the given list should be displayed in a compact form. For example, the font or the distance between list lines, etc. may be reduced.

                                                                          Note

                                                                          Currently, the presence of the COMPACT parameter in the tag

                                                                            does not in any way affect the display of lists in leading browsers. Therefore, using this parameter is pointless, especially since its use is not recommended by the HTML 4.0 specification.

                                                                            The TYPE parameter can take the following values: disc, circle and square. This parameter is used to force the appearance of list bullets. The exact type of marker will depend on the browser you are using. Typical display options are as follows:

                                                                            TYPE = disc - markers are displayed as filled circles; TYPE = circle - markers are displayed as open circles; TYPE = square - markers are displayed as filled squares. Example entry:

                                                                              .

                                                                              The default value is TYPE = disc. For nested bulleted lists, the default value is disc at the first level, circle at the second level, square at the third level and beyond. This is exactly what is done in the latest versions of Netscape and Internet Explorer browsers. Please note that other browsers may display markers differently. For example, in the HTML 4.0 specification, the type of marker displayed when TYPE = square is specified as a square outline.

                                                                              The TYPE parameter with the same values ​​can be used to specify the type of markers for individual list elements. To do this, the TYPE parameter with the corresponding value is allowed to be specified in the list element tag

                                                                            • .

                                                                              Example entry:

                                                                            • .

                                                                              Note

                                                                              Browsers interpret the bullet type specification for an individual list item differently. The Netscape browser changes the appearance of the marker for this and all subsequent ones until the next redefinition of the appearance of the marker is encountered. Internet Explorer changes the appearance of the marker only for this element.

                                                                              Graphic list markers

                                                                              You can use graphic images as list bullets, which is widely used to create attractive, well-designed HTML documents. In fact, this possibility is not provided directly by the HTML language, but is implemented somewhat artificially. This does not mean that doing so is not recommended or reprehensible, but only that no special HTML language constructs will be used here.

                                                                              To understand the idea, you need to understand the mechanism for implementing lists on HTML pages. It turns out that the list tag

                                                                                (as, indeed, list tags of other types, discussed below) performs a single task - it tells the browser that all information located after this tag should be displayed shifted to the right (indented) by a certain amount. Tags
                                                                              • , which point to individual list items, provide standard list item markers.

                                                                                If we need to build a list with graphic markers, then we can do without tags altogether

                                                                              • . It will be enough to insert the desired graphic image before each element of the list. The only problem that needs to be solved is separating the list elements from each other. You can use paragraph tags for this

                                                                                Or force a line feed
                                                                                . An example of implementing a list with graphic markers, the display of which is shown in Fig. 2.2 is shown below:

                                                                                Bulleted list

                                                                                  Zodiac signs:

                                                                                    Aries

                                                                                    Taurus

                                                                                    Gemini

                                                                                    Cancer

                                                                                    Leo

                                                                                    Virgo

                                                                                    Scales

                                                                                    Scorpion

                                                                                    Sagittarius

                                                                                    Capricorn

                                                                                    Aquarius

                                                                                    Fish

                                                                                Rice. 2.2. Bulleted list with graphic bullets

                                                                                In the example given, the graphic file Green_ball.gif is used as a list item marker. Note that the use of graphics on HTML pages can significantly increase the amount of information transmitted. However, in this case this increase is extremely insignificant. Here the same file is used for all markers,

                                                                                which will be transmitted only once. The file sizes of a small image are also extremely small.

                                                                                Note

                                                                                Techniques for creating lists with graphical bullets are discussed in turn in Chapter 8.

                                                                                Numbered list

                                                                                Another type of list implemented in HTML is the numbered list. Otherwise, lists of this type are called ordered. The last name is often used as a formal translation of the name of the corresponding tag

                                                                                  , with the help of which lists of this type are organized in HTML documents (OL - Ordered List, ordered list).

                                                                                  Lists of this type are usually an ordered sequence of individual elements. The difference from bulleted lists is that in a numbered list, each element is automatically preceded by a serial number. The type of numbering depends on the browser and can be set by the parameters of the list tags. Otherwise, the implementation of numbered lists is very similar to the implementation of bulleted lists.

                                                                                  Tags

                                                                                    And
                                                                                  1. To create a numbered list, you should use a container tag, inside which all the elements of the list are located. The opening and closing list tags provide a line break before and after the list, thereby separating the list from the main content of the document.

                                                                                    As with a bulleted list, each item in a numbered list must begin with the tag

                                                                                  2. .

                                                                                    Here's an example of an HTML document using a numbered list: display of which browser is shown in Fig. 2.3.

                                                                                    Example of a numbered list

                                                                                      The brightest stars visible from Earth:

                                                                                      • Sirius

                                                                                      • K anopus

                                                                                      • Arcturus

                                                                                      • Alpha Centauri

                                                                                      • Vega

                                                                                      • K appella

                                                                                      • Rigel

                                                                                      • Procyon

                                                                                      • Achernar

                                                                                      • Beta Centauri

                                                                                      • Wetelgeuse

                                                                                      • Aldebaran


                                                                                        . . .

                                                                                      • Mizar


                                                                                        . . .

                                                                                      • Polar

                                                                                    Rice. 2.Z. Numbered list

                                                                                    In the tag

                                                                                      The following parameters can be specified: COMPACT, TYPE and START.

                                                                                      The COMPACT parameter has the same meaning as bulleted lists. The TYPE parameter is used to specify the type of list numbering. Can take the following values:

                                                                                      TYPE = A - sets markers in the form of capital Latin letters;

                                                                                      TYPE = a - sets markers in the form of lowercase Latin letters;

                                                                                      TYPE = I - sets markers in the form of large Roman numerals;

                                                                                      TYPE = i - sets markers in the form of small Roman numerals;

                                                                                      TYPE = 1 - sets markers in the form of Arabic numerals.

                                                                                      The default value is always TYPE = 1, i.e. numbering using Arabic numerals. This also applies to nested numbered lists. Here, unlike bulleted lists, browsers by default do not make the numbering different at different levels of nesting of lists. Note that after the number of the list element there is always an additional “dot” sign.

                                                                                      The TYPE parameter with the same values ​​can be used to specify the numbering style for individual list elements. To do this, the TYPE parameter with the corresponding value is allowed to be specified in the list element tag

                                                                                    1. .

                                                                                      Example entry:

                                                                                    2. .

                                                                                      START tag parameter

                                                                                        allows you to start numbering the list from something other than one. The value of the START parameter must always be a natural number, regardless of the type of list numbering. Here's an example:

                                                                                          .

                                                                                          This entry determines the numbering of the list starting with the capital Latin letter "E". For other types of numbering, the entry START=5 will set the numbering, respectively, from the number "5", the Roman numeral "V", etc.

                                                                                          Changing the type of list numbering and number values ​​can be done for any element of the list. Tag

                                                                                        1. for numbered lists, allows the use of the TYPE and VALUE parameters. The TYPE parameter can take the same values ​​as for the tag
                                                                                            .

                                                                                            P example entry:

                                                                                          1. .

                                                                                            Note

                                                                                            Browsers interpret the numbering type for an individual list item differently. The Netscape browser changes the type of numbering for this element and all subsequent ones until the next override is encountered. Internet Explorer changes the appearance of the number only for this element.

                                                                                            Zvalue of the VALUE tag parameter

                                                                                          2. - allows you to change the number of a given list element. This changes the numbering of all subsequent elements. A typical application is lists with some elements missing. An example of such a list was given above (Fig. 2.3). It provides an ordered list of the brightest stars, in which the 58th and 75th places contain stars that are clearly visible at our latitudes (Mizar is the brightest star in the constellation Ursa Major, and Polaris is the brightest star in the Ursa Minor constellation).

                                                                                            Let's give another original example of using different types of numbering. The HTML code below contains three lists with different numbering. For ease of viewing, each of the lists is placed in a separate table cell. All three lists are identical and differ only in the type of numbering: in the first column of the table there are Arabic numerals, in the second - Roman numerals, and in the third the numbering is in Latin letters. Please note that the list elements are empty, i.e. after any tag

                                                                                          3. there is no data. An example of this kind can be used as a table of correspondence between writing numbers in Arabic and Roman numerals. It turns out that any browser that supports lists can be used as a generator of such a table (Fig. 2.4), you just need to type the given HTML code. Numbering in Roman numerals works correctly up to the value 3999. By studying the right column, you can understand how numbering in Roman letters is done. Once the one-letter numbering (from A to Z) is exhausted, the first two-letter number is taken as the next number - AA, etc.

                                                                                            Using different types of numbering in lists


                                                                                              1. . . .


                                                                                            1. . . .


                                                                                            1. . . .

                                                                                            Rice. 2.4. Different types of HTML list numbering

                                                                                            List of definitions

                                                                                            Definition lists, also called definition dictionaries, are a special type of list. Unlike other types of lists, each element of a definition list always consists of two parts. The first part of the list element contains the term being defined, and the second part contains text in the form of a dictionary entry that reveals the meaning of the term.

                                                                                            Definition lists are specified using a container tag

                                                                                            (Definition List). Inside the container with a tag
                                                                                            (Definition Term) the term being defined is marked, and the tag
                                                                                            (Definition Description) - a paragraph with its definition. For tags
                                                                                            And
                                                                                            You can omit the corresponding closing tags.

                                                                                            In general, the list of definitions is written as follows:

                                                                                            Term

                                                                                            Definition of the term

                                                                                            In the text after the tag

                                                                                            block level elements such as paragraph tags cannot be used

                                                                                            Or headers

                                                                                            -

                                                                                            . As a rule, the text of the defined term should be located on one line. The text containing the definition of the term is displayed starting on the next line (or every line for some browsers) after the definition of the term, indented to the right. In the information placed after the tag
                                                                                            , block-level elements can be located. It follows, in particular, that lists of definitions can be nested.

                                                                                            In the tag

                                                                                            a COMPACT parameter may be specified, the purpose of which is similar to the other lists described above.

                                                                                            Here is an example of an HTML document that uses a list of definitions:

                                                                                            Definition list example

                                                                                            Classification of typical human temperaments,
                                                                                            based

                                                                                            on the views of Hippocrates

                                                                                              Phlegmatic person

                                                                                              Passive, very hard-working, slow to adapt;
                                                                                              stable mood, little susceptible to external influence;
                                                                                              lethargy of emotional reactions and slowness in volitional activity

                                                                                              Sanguine

                                                                                              Active, energetic, adaptable, -
                                                                                              liveliness and mobility of emotional reactions, speed and strength of volitional manifestations

                                                                                              Choleric

                                                                                              Active, very energetic, persistent;
                                                                                              impetuosity and strength of emotional reactions, violent manifestations of will

                                                                                              Melancholic

                                                                                              Passive, easily tired, difficult to adapt, -
                                                                                              weakness of volitional manifestations and the predominance of depressed mood, self-doubt

                                                                                            The display of the given HTML document in the browser is shown in Fig. 2.5.

                                                                                            Rice. 2.5. List of definitions (similar to a group of entries in a dictionary)

                                                                                            Lists type

                                                                                            And

                                                                                            Lists type

                                                                                            And are currently practically not used, although they are still supported by leading browsers. In the HTML 4.0 specification, both of these list types are marked as deprecated. Instead, it is proposed to use bulleted lists specified by the tag
                                                                                              .

                                                                                              These types of lists were originally designed to be more compact than regular bulleted lists. According to the rules for writing elements of these lists, it was not allowed to use block elements in them, which means it was impossible to implement nesting of lists of this type. Each list element was one line of text.

                                                                                              For lists like

                                                                                              it was planned to introduce a limit on the “length of the text of a list element (24 characters). Such a limitation would allow us to derive

                                                                                              lists like

                                                                                              in a form similar to the output of a list of directories in the UNIX and MS-DOS operating systems when using the /W switch (in several columns). In addition, markers were not displayed for list items of this type.

                                                                                              Currently, all these plans have not been implemented, since further use of lists of these types is not recommended. Modern versions of browsers display lists of these types in exactly the same way as lists like

                                                                                                .

                                                                                                Nested Lists

                                                                                                There are times when you need to include an entire list of the same type or another in a list element of one type. This will create multi-level or nested lists. HTML allows arbitrary nesting of various types of lists, but care must be taken when organizing them.

                                                                                                Below is the HTML code for a document with nested lists, the display of which is shown in Fig. 2.6. In this example, each item in the bulleted list contains its own numbered list.

                                                                                                Nested list example

                                                                                                  Satellites of some planets

                                                                                                • Zempya

                                                                                                    1. Moon

                                                                                                • Mapc

                                                                                                    1. Phobos

                                                                                                    2. Deimos

                                                                                                • Uranus

                                                                                                    1. Ariel

                                                                                                    2. Umbriel

                                                                                                    3. Titania

                                                                                                    4. Oberon

                                                                                                    5. Miranda

                                                                                                • Neptune

                                                                                                    1. Triton

                                                                                                    2. Nereid

                                                                                                  HTML supports three different types of lists, each of which has its own list types:

                                                                                                    1. – a numbered (using numbers or letters) list, each element of which has a serial number (letter);
                                                                                                      • – a bulleted (not numbered) list, next to each element of which a marker is placed (rather than numeric or alphabetic characters indicating a serial number);
                                                                                                      • – a definition list consists of name/value pairs, including terms and definitions.

                                                                                                      Numbered lists

                                                                                                      In a numbered list, the browser automatically inserts element numbers in order, starting with a certain value (usually 1). This allows you to insert and delete list items without disturbing the numbering, since the remaining numbers will be automatically recalculated.
                                                                                                      Numbered lists are created using a block element

                                                                                                        (from the English Ordered List - numbered list). Next to the container
                                                                                                          for each list item an element is placed
                                                                                                        1. (from the English List Item - list item). The default is a numbered list with Arabic numbers.
                                                                                                          Tag
                                                                                                            has the following syntax:

                                                                                                            1. element 1
                                                                                                            2. element 2
                                                                                                            3. element 3

                                                                                                            Numbered list items must contain multiple list items, as shown in the following example:

                                                                                                            Example: Numbered List

                                                                                                            • Try it yourself "

                                                                                                            Step-by-step instruction

                                                                                                            1. Get the key
                                                                                                            2. Insert the key into the lock
                                                                                                            3. Turn the key two turns
                                                                                                            4. Get the key out of the lock
                                                                                                            5. Open the door

                                                                                                            Step-by-step instruction

                                                                                                            1. Get the key
                                                                                                            2. Insert the key into the lock
                                                                                                            3. Turn the key two turns
                                                                                                            4. Get the key out of the lock
                                                                                                            5. Open the door

                                                                                                            Sometimes when looking at existing HTML codes you will come across the argument type in element

                                                                                                              , which is used to indicate the type of numbering (letters, Roman and Arabic numerals, etc.). Syntax:

                                                                                                                Here: type – list symbols:

                                                                                                                • A - capital Latin letters (A, B, C...);
                                                                                                                • a - lowercase Latin letters (a, b, c...);
                                                                                                                • I - large Roman numerals (I, II, III...);
                                                                                                                • i - small Roman numerals (i, ii, iii...);
                                                                                                                • 1 - Arabic numerals (1, 2, 3 . . .) (used by default).

                                                                                                                If you want the list to start with a number other than 1, you should specify this using the attribute start tag

                                                                                                                  .
                                                                                                                  The following example shows a numbered list with large Roman numerals and a starting value of XLIX:

                                                                                                                  Numbering can also be started using the attribute value, which is added to the element

                                                                                                                1. in the following way:

                                                                                                                2. In this case, the sequential numbering of the list will be interrupted and from this point the numbering will begin again, in this case from seven.

                                                                                                                  Attribute usage example value tag

                                                                                                                3. , which allows you to change the number of a given list element:

                                                                                                                  In this example, the "First List Item" would be number 1, the "Second List Item" would be number 7, and the "Third List Item" would be number 8.

                                                                                                                  Formatting Numbered Lists with CSS

                                                                                                                  To change list numbers you should use the property list-style-type CSS style sheets:

                                                                                                                    Numbered list styles
                                                                                                                    ExampleMeaningDescription
                                                                                                                    a, b, clower-alphaLower case
                                                                                                                    A, B, Cupper-alphaCapital letters
                                                                                                                    i, ii, iiilower-romanRoman numerals in lowercase letters
                                                                                                                    I, II, IIIupper-novelRoman numerals in capital letters

                                                                                                                    Example: Applying a CSS Property list-style-type

                                                                                                                    Bulleted lists

                                                                                                                    Bulleted lists are essentially similar to numbered lists, only they do not contain sequential numbering of items. Bulleted lists are created using a block element

                                                                                                                      (from the English Unordered List - unnumbered list). Each list element, as in numbered lists, begins with a tag
                                                                                                                    • . The browser indents each list item and automatically displays bullets.
                                                                                                                      Tag
                                                                                                                        has the following syntax:

                                                                                                                        • First point
                                                                                                                        • Second point
                                                                                                                        • Third point

                                                                                                                        In the following example, you can see that, by default, a small marker in the form of a filled circle is added before each list item:

                                                                                                                        Inside a tag

                                                                                                                      • It is not necessary to place only text; it is acceptable to place any element of streaming content (links, paragraphs, images, etc.)

                                                                                                                        Nested Lists

                                                                                                                        Any list can be nested within another. Inside an element
                                                                                                                      • It is permissible to create a nested list or a second-level list. To nest a list, describe the new list inside the element
                                                                                                                      • already existing list. When you nest one bulleted list into another, the browser automatically changes the bullet style for the second-level list. Any list can be nested within another. The following example demonstrates the structure of a bulleted list nested within the second item of a numbered list.

                                                                                                                        Example: Nested Lists

                                                                                                                        • Try it yourself "
                                                                                                                        • Monday
                                                                                                                          1. Send mail
                                                                                                                          2. Visit to the editor
                                                                                                                            • Choosing a theme
                                                                                                                            • Decorative design
                                                                                                                            • Final report
                                                                                                                          3. Evening viewing of messages
                                                                                                                        • Tuesday
                                                                                                                          1. Revise schedule
                                                                                                                          2. Send images
                                                                                                                        • Wednesday...

                                                                                                                        • Monday
                                                                                                                          1. Send mail
                                                                                                                          2. Visit to the editor
                                                                                                                            • Choosing a theme
                                                                                                                            • Decorative design
                                                                                                                            • Final report
                                                                                                                          3. Evening viewing of messages
                                                                                                                        • Tuesday
                                                                                                                          1. Revise schedule
                                                                                                                          2. Send images
                                                                                                                        • Wednesday...

                                                                                                                        Formatting Bulleted Lists

                                                                                                                        To change the appearance of the list marker, you should use the property list-style-type CSS style sheets:

                                                                                                                          The following example shows different styles of bulleted lists:

                                                                                                                          Example: Bullet List Styles

                                                                                                                          • Try it yourself "
                                                                                                                          • Coffee
                                                                                                                          • Coffee
                                                                                                                          • Coffee
                                                                                                                          • Coffee

                                                                                                                          Disc:

                                                                                                                          • Coffee
                                                                                                                          • Milk

                                                                                                                          Circle:

                                                                                                                          • Coffee
                                                                                                                          • Milk

                                                                                                                          Square:

                                                                                                                          • Coffee
                                                                                                                          • Milk

                                                                                                                          None:

                                                                                                                          • Coffee
                                                                                                                          • Milk

                                                                                                                          Graphic markers.

                                                                                                                          In HTML it is possible to create a list with graphic markers. It’s one thing when the list markers are standard circles or squares, and quite another when the developer himself selects the marker in accordance with the page design. In order to make list items beautiful, small pictures are often used.
                                                                                                                          To replace a regular marker with a graphic one, replace the property list-style-type per property list-style-image and indicate the URL of the image:

                                                                                                                            Example: Graphic Markers

                                                                                                                            • Try it yourself "

                                                                                                                            Zodiac signs

                                                                                                                            • Taurus
                                                                                                                            • Gemini

                                                                                                                            Zodiac signs

                                                                                                                            • Aries
                                                                                                                            • Taurus
                                                                                                                            • Gemini

                                                                                                                            Lists of definitions (descriptions)

                                                                                                                            Definition lists are very useful for creating, for example, your personal dictionary of terms. Each definition list item has two parts: the term and its definition.
                                                                                                                            You put the entire list into an element

                                                                                                                            (from the English Definition List - list of definitions). It includes tags
                                                                                                                            (from the English Definition Term - a defined word, term) and
                                                                                                                            (from the English Definition Description - description of the term being defined).
                                                                                                                            Lists of definitions are often used in scientific, technical and educational publications, using them to compile glossaries, dictionaries, reference books, etc.

                                                                                                                            The general structure of the list of descriptions is as follows:

                                                                                                                            First term
                                                                                                                            Description of the first term
                                                                                                                            Second term
                                                                                                                            Description of the second term

                                                                                                                            The following example shows one possible use of a definition list:

                                                                                                                            Example: Definition List

                                                                                                                            • Try it yourself "

                                                                                                                            World Wide Web - from English. The World Wide Web (WWW) is a distributed system that provides access to related documents located on different computers connected to the Internet. The Internet is a set of networks that use a single exchange protocol to transmit information. A website is a set of individual web pages that are interconnected by links and a uniform design.

                                                                                                                            The World Wide Web
                                                                                                                            - from English The World Wide Web (WWW) is a distributed system that provides access to related documents located on different computers connected to the Internet.
                                                                                                                            Internet
                                                                                                                            — a set of networks that use a single exchange protocol to transmit information.
                                                                                                                            Website
                                                                                                                            - a set of individual web pages that are interconnected by links and a uniform design.

                                                                                                                            By default, the text of the term is pressed to the left edge of the browser window, and the description of the term is located below and shifted to the right.