The InternetWeb design

CSS: hover. Original hover-effects

Fundamentally new was the idea to divide the representation of information from the code of its creating and processing. It was a strong decision at the time, but this moment was not recognized then to the fullest. When programming was separated from a single computer, but it did not win over a local network or a single domain zone, but spread all over the place, only then it became obvious that the presentation of information (in the design part) and working with it (in the code part) - two Sides in the same plane.

Three sides of site building

From a formal point of view, there are three main components (in different syntactic forms) that make up the site: PHP code, JavaScript code and CSS style descriptions. It does not matter how the version is used and which version is used, which version of HTML markup is used and what version of the browser it is worth. Compatibility is not respected now, therefore at every moment of time it is actual: what is encoded and what from what is encoded can be displayed and executed .

If earlier the ideas were fought with languages, today it is more like the manufacturers of standards in the field of Internet technologies and browsers.

Personal and public

The means by which the Internet is accessible, a lot (computers, laptops, tablets, smartphones), browsers, too, abound. There is no guarantee that a single device will display the site in the form in which it was created by the developer. Not always the efforts of the latter reach the goal and provide web design with a single multi-faceted, that is, a unity of the entity's display, wherever it opens up to the visitor.

Sharing the personal and the public, using in the latter only what works, you can achieve notable success in design. Beauty, artistic moment and web design are the part of the corresponding specialists and talents. CSS is a code, although it is very peculiar. His concern is to describe the styles (information display options). With the advent of mobile devices, CSS was loaded with real coding in the form of media queries. So the option of remarriage between design and code is not such an unreality as it could have seemed just a couple of years ago.

The developer, working on the development of CSS-styles, relies on his personal proven experience and for those CSS designs that work on most browsers, satisfy the majority of visitors to the site. It is necessary to make maximum use of the first and the minimum of the second, then there is much more chance of getting the result, working almost always and everywhere.

The first rule: on the standard, hope, but he is not bad

CSS: hover - this is when the mouse "went" to the page element. When the mouse clicked on the element, it becomes active, but when the cursor goes to the side, it can again change and show itself in the active state. ": Hover", "active" and "visited" are the most popular pseudo-classes when describing styles.

It is very convenient in the code of the site not to care about such trifles as the movement of the mouse over the elements. Provided in the table of descriptions of styles two descriptions:

Element {

Color: black;

}

Element: hover {

Color: white;

Background-color: green;

}

Get when you hover the mouse on the element automatically change the color of the text from black to white and change the background of this element to green. Pseudo-classes can be applied to any element and achieve a variety of visual effects.

The second rule: trusting the standards, focus on your code

Everything would be fine if the progress remained at the level of computers and laptops equipped with mouse, and the progress in the cellular communication did not lead to the appearance of smartphones, tablets and other mobile devices, to which it is very difficult to connect such a device.

On the other hand, only on gadgets equipped with special touch-screen gadgets, it is possible to manipulate fingers directly on the touch screen, as has already become common on smartphones, tablets and similar devices.

There is a significant difference and: the hover here does not work at all the way we would like. You can not do without code here, and not all questions solve the use of media queries.

Compatibility is too expensive in the modern information world, therefore, in order to provide proper functionality to the site within the established requirements for web design and implementation of the functionality, it is preferable to focus on the minimum necessary use cases: CSS hover, CSS hover active, . The more code (both inside the browser and on the server) controls web design, the better. The program is control, it's better when this control is not surrendered to acting standards, from which you often do not know what to expect.

Buttons and other page elements

Button hover CSS is a wonderful solution, but by and large each element of the page is a "button". The site must be first and foremost live, and if it is not included in the code, if the task is to create a site that develops adequately to the field of application and operates according to the visitor's behavior, then at least using CSS styles can give liveliness to the elements of the page.

Use hover-effects conveniently. With their help, you can easily make pages livelier, but the code does not know what the mouse is doing on the screen if it does not have the ability to track its movement. From this point of view, that is, when the code controls the movement of the mouse (= movement of the finger on the smartphone), it can independently highlight the item or convert it. This has nothing to do with pseudo-classes, but gives full control over the code of the external appearance of the page, allows you to adequately display it on different devices in different browsers.

Pitfalls in style sheets

To say that they are standard in the description of styles CSS do not know what they are doing, it is impossible, but they can not be said to fully interact with the rest of the standards in the field of Internet programming.

Styles and pseudo-classes can be described at the page encoding stage, at the moment when the server forms the page and in dynamics: already being inside the browser, it is easy to create a new style and change the existing one.

Using AJAX, when there is no need to regenerate the page to reflect the reaction to the visitor's action, but just change its element or several elements adds a little "pepper". "Friendship" codes - the fact that already in the browser (JavaScript) and the fact that the server (PHP) - the destiny of the author (programmer) site.

From how the algorithm of this interaction will be executed, essentially depends not only the display on the page of its elements, but also their further perception by code. Simply put, pseudo-classes (in particular) are very good for statics, sort of like for a sailing yacht in a clean sea with a light wind - everything is obvious, accessible and manageable. If the weather changes, or when the wind increases, or the visitor causes an unforeseen situation, you can quickly fly into the reef and lose the visitor.

Standard and its emulation

CSS style hover can be emulated through JavaScript, by using onmouseover and onmouseout events. Often this all ends. From the standpoint of common sense, when it comes to creating a real working site, it's better to hold control in your hands than to give it to the mercy of mythical standards that change beyond the will and desire of the developer.

Sometimes you can read something like "this feature is available even in IE", but more often you can read about what style descriptions are perceived by this or that browser. It is much less likely to learn about how JavaScript differs in certain browsers.

Evaluating the accumulated experience, admiring the possibilities of "Chrome" and "Opera", criticizing the slowness and inertness of the browser from the manufacturer (the unforgettable, dear to the heart of any programmer IE from Microsoft: "The good old Internet Explorer did not scold only the lazy. Or someone on the computer Only knows how to play in the "Scythe" ", - quoted by an unknown Internet author), one should adhere to the golden mean: to use what works everywhere and always.

People need money to work when they need to get the thrill they usually go to the registry office or the theater, but not on the Internet.

Emulation and control

Earlier, when programming was getting on its feet, it was customary to listen to the elders and write correctly. Now there are too many elders, everything is changing too quickly, and if you listen to everyone, then there will not be enough time for even a very simple job, at a minimal functional website.

Programming is primarily control, and in cases where the standard objectively establishes the rules, or you can expect a sharp change in the rule, its elimination and the emergence of a new one, the best solution was always not to make any decisions, but to implement the required site functionality with the minimum possible but actually working code .

Similar articles

 

 

 

 

Trending Now

 

 

 

 

Newest

Copyright © 2018 en.unansea.com. Theme powered by WordPress.