The syntax of cascading style sheets is built so simply that the ability to get the most unexpected design is available even to a person far from programming and website development. It is possible that children’s dice games were left in everyone’s memory to use this multifaceted experience in HTML, CSS is not difficult.
However, modern programming is still very far from representing the constructions of reality. Until now, any area (occupied by any block element) in any of its meaning and formal purpose has a rectangular shape, within which the desired curved contour line is formed.
Until now, any circle, radius of rounding, a slightly curved straight line, etc., are described by complex mathematical equations or very small cubes, trapezoids, triangles, or other rectilinear elements that are distinguishable to the eye as a point on a line.
Classic straight designs
It is not surprising that advances in programming and information technology have legitimized rectangular designs. Advanced ideas did not begin to waste time on round shapes, but did not forget to provide the developer with enough features in the tags and rules of HTML, CSS and related programming languages.
Any element used on the page has a rectangular area, and several components are highlighted in it, of which in each case only the necessary should be used, taking into account the requirements of cross-browser compatibility, features of marking up specific content in accessible syntax constructions.
General CSS Rules
Cascading style sheets suggest describing elements like this:
In this case, the property is a specific name, and the value can be either a name or an enumeration of names or values.
Regarding block elements and the need to round corners with CSS, it makes sense to use the border-radius property and its values ​​in the format "38px" or "8px 16px 24px 38px".
If a value is set to one number, it will be set as such for all angles. Recording all four values ​​includes:
- the first number is to the upper left corner;
- the second - to the upper right;
- the third is to the lower right;
- the last to the bottom left.
Sharing some rules
The concepts border, image and background can be used together. This is normal, and these rules do not interfere with each other, forming a common composition. The main thing is to give an account of what exactly each of them means, and how it is superimposed.
Before implementing this or that element, it is important to conduct several experiments and test the work on several browsers. Focusing on tips, tricks, third-party examples or CSS syntax, rounding corners, etc. is rarely better than your own fresh practice.
It is important to understand that border, image, from the point of view of the design of corners, are of the same type. The picture may not be presented in png format. It will be cropped by the browser according to the rules set in CSS. The rounding of corners is the developer’s concern, regardless of the rectangularity of the source material.
Features HTML, CSS from browsers
Wholesale style recording is welcome - for all browsers at once. In any case, classic examples on the subject of “CSS: rounding off corners” suggest writing like this:
background: # FF7F00; /* background */
border: 1px #CCCCCC solid; / * frame * /
-moz-border-radius: 10px; / * CSS rounding corners for Mozilla Firefox * /
-webkit-border-radius: 10px; / * ... for Chrome and Safari * /
-khtml-border-radius: 10px; / * ... Konquerer * /
border-radius: 10px; / * CSS rounding corners for all * /, etc.
However, in most cases it is enough to indicate the last rule. Redundancy should be used only when there is a real need for it.
Classic and marvelous tables
Despite numerous disputes between supporters of table layout (tr, td) and the use of div and span tags (“marvelous” layout), objective practice prefers the option of reasonable necessity.
Divas have some advantages, tables have others. If they did not complement each other, but simply competed, the question would quickly disappear into one option, combining the best sides of tables and divas.
Most sites are created using CMS (site management systems) and not only a wide range of "giant" data arrays, hundreds of folders, objects, but also tables comes to the disposal of the developer.
Tags [div | span], as such, do not stand out, but the only thing that definitely comes to the full mercy of the developer is CSS styles. Moreover, any CMS clearly separates both the code included in it from the developer’s creativity and its own styles from the added styles, and with regard to changes (for example, in css - rounding off the corners of the table), you can always restore the settings and styles to default.
Curves and angles not provided by the syntax
You can strictly follow all the rules of HTML, CSS, but have a result that is not provided for by them. Overlaying elements on top of each other, you can get any areas of any configuration. Using PHP programming on the server, you can send any style files to the visitor’s browser and attach the corresponding JavaScript code to them in the body of the HTML file or a separate js file.
Any variant of the outline, any form of its own element outside the CSS rules! The rounding of corners is just a particular, and the real possibilities are much wider. At the same time, programming your own objects, you can not pay attention to the features of individual browsers, use only those tags and hypertext language designs that are perceived by all browsers without exception.
Using the ideas of object-oriented programming, you can design the appearance of an angle or curve, obviously not provided by any browser form. Moreover, it is not at all necessary that this will be exactly the corner of the region, initially rectangular in shape. It is important that the components of the curve described in the form of CSS rules are combined into a single visual object with JavaScript code and at the right time, in the right place in the browser, reflect themselves in the correct form.
With this technology, nothing prevents such objects from realizing themselves in a three-dimensional plane or showing animation.