Prior to creating HTML / CSS, there was no problem with font size selection. The typewriter mechanism had only one set of characters of the same size. In the absence of other possibilities, people perfectly communicated with each other, created works of art, designed nuclear power plants, flew into space and entered sophisticated programs into the memory of computers through punch cards using punchers, which is only 1 or 0.
Beautiful website with professional design
When Internet programming took its rightful place in society and became an urgent need, designers and website owners considered it normal to create web masterpieces.
Developers of HTML / CSS standards, browsers and various tools responded to the needs of developing web resources, but pretty quickly everything returned to normal. In fact, it is important for the site developer to do the job quickly and efficiently, and the site visitor to get information. Everyone knows how to draw and speak, but it is much more important to transmit / receive information.
Practice and real need are not art, but life, work or rest in an effective, simple and practical way. You can set any font size in HTML / CSS without any problems. But this is not always the point.
A beautiful site is not a professional design, but a professional performance that provides the necessary functionality in an understandable and convenient format for the visitor.
CSS font management features
This example simply demonstrates the basic possibilities of using the CSS font arsenal to describe HTML tags.
The description of the styles is as follows.
From the very beginning, HTML offered to encode a text tag - p. We can say that the body of a web page is a body tag, and then a lot of p, div, span and other tags. From the very beginning CSS suggested rules - set the font, color, size, alignment and others.
The modern implementation of HTML / CSS support in browsers allows you to dynamically influence CSS rules: changing the font size is not an exception here, but a frequently used action.
The logic of the formal approach
HTML and CSS are powerful formal data presentation systems. The programming experience of many decades, the knowledge and skills of hundreds of thousands of qualified professionals have led to the creation of fundamental rules for the description and use of data.
Setting the font size on CSS is not a problem. Changing it in a server-side script when creating a page is elementary. As soon as the page got into the browser and he built the DOM (tree of page objects), using JavaScript you can easily control everything, and the font size is no exception.
Why, in what cases and how to change the font size? CSS rules are static, JavaScript is dynamic. Through the DOM and the JavaScript handler, the programmer has dynamic access to any CSS rule. Not just dynamic: you can change something in the direction of the visitor and the site’s own timer in time.
You can change everything described in the CSS file: font sizes, font families, colors, alignment, and any other rules. You can do everything so that the site will not wait for the actions of a particular visitor, but will take into account the behavior of all visitors to the site and / or the logic of the developer.
Natural Logic and Keyboard
A person does not show another person in communication either the color, or the family of fonts used, or their sizes. Communication in people is always emotionally colored. Over the period of book printing, the typewriter has successfully dealt with the needs of people.
Before the advent of computers and text editors with an amazing variety of font descriptions, enough scientific, technical and creative achievements were created.
These circumstances with all objectivity explain why the wide possibilities of HTML and CSS in modern Internet programming tend to practical and comfortable implementation. There is no longer that variegation of tags, the application of flashing rules, rotating text strings and running objects.
Until now, a simple keyboard (like a simple typewriter) has a set of characters and signs, but it still does not have a font size button. It doesn’t occur to the developer to change the font size of the CSS rule of the input field. He is more concerned with how to provide a convenient dialogue: input / output of information.
Adaptive layout, the need to simplify everything so that the visitor on the computer sees and understands everything as on a smartphone or tablet are also significant circumstances.
CSS font sizes can be changed by itself. CSS is not just tagging rules. These are classes, identifiers, pseudo-classes, and pseudo-elements. By combining CSS descriptions, you can abandon the use of JavaScript in solving some problems. For example, CSS can change font sizes using a combination of: a, a: hover, a: visited, a: active ...
After completing the basic description for a, you can refine it in hover, visited, and active. The developer has a lot of features, but he already has an understanding of what is sufficient and necessary to use these features.
Window, line and character size
It is basically true that the size of the window determines the device used, but this is not always the case. Window size can uniquely determine the correct font sizes. The CSS description file should automatically adapt to the desired size not only of the font, but also the content of the line of text, each visible block.
Do not impose on your visitor your combination of HTML page element sizes. By and large, it is up to the visitor to decide how the page should look. It is in his browser "gets" the developer with his ideas for functionality and page design.
The developer operates on the server, and he sends a code to the visitor’s browser that can be controlled by the visitor’s browser. The latter may influence this management.
CSS font sizes are not determined by character size. Even the use of proportional fonts does not solve the problem of the length of the line that needs to be sent to a particular page tag.
In the above example, a “developer error” was made - lines 4 and 5 contain Times 14px, but are displayed in different sizes. Nearby tags carry the same error. In other words, there is no connection between:
- text
- the tag in which it is located;
- CSS rule for font size.
In fact, creating a page, the developer suggests how and what it should look like, where it should be, what size it should be. No matter how strange it may sound, but any page of the most popular and high-quality site appears in the browser of the visitor, like a person in his apartment, and tries to establish his order.
Optimal size
Objective reality is an example of "the appropriateness of size." A bee cannot be bigger than it is, and a plane cannot be as big as a bee.
Virtuality is a world of limitless possibilities, but it becomes such only when guided by the objective requirements of necessity and sufficiency. Everything should be within reason.