color
not only text colorscolor
property is used by developers constantly. Those of you who have not so much experience with CSS may not have known that this property determines not only the text color! <img alt="Example alt text" width="200" height="200"> <ul> <li>Example list item</li> </ul> <ol> <li>Example list item</li> </ol> <hr>
body { color: yellow; background: #444; font-size: 20px; font-family: Arial, sans-serif; text-align: center; } ul { border: solid 2px; text-align: left; } ol { text-align: left; } hr { border-color: inherit; }
color:yellow
property is used only once for the body
element. As you can see, everything turned yellow:hr
hr
element does not inherit the value of the color
property, but this can be achieved by setting the border-color
property to inherit
. As for me, this is somewhat strange behavior.This property describes the foreground color of the text content of the element. In addition to this, it can be indirectly used by other properties that take on color values.
visibility
property can be set to collapse
visibility
property more than once. The “normal” values ​​are visible
(by default on all elements) and hidden
, which hides the element, leaving space for it (as opposed to display:none
).collapse
. It works the same way as hidden
with respect to all elements, except for tabular rows, columns and their groups. In the case of table elements, it is assumed that the collapse
value will hide them like display:none
in such a way that other contents of the table will be located at the place they previously occupied.collapse
and hidden
not observed (see this bug report and comments )collapse
seems to work as it should: the table row is deleted, and the one that was below goes upvisibility:collapse
.background
property valuesbackground
property included five values ​​for the following properties: background-color
, background-image
, background-repeat
, background-attachment
and background-position
. Since CSS 3, three more values ​​have been added, so this property now looks like this: background: [background-color] [background-image] [background-repeat] [background-attachment] [background-position] / [background-size] [background-origin] [background-clip]
font
property and border-radius
[link]. This slash will allow you to turn on the background-size
value after the background-position
in those browsers that support it. You can also add two more values: background-origin
and background-clip
. .example { background: aquamarine url(img.png) no-repeat scroll center center / 50% content-box content-box; }
clip
property works only on absolutely positioned elements.clip
property. It is used like this: .example { clip: rect(110px, 160px, 170px, 60px); }
.example { position: absolute; clip: rect(110px, 160px, 170px, 60px); }
clip
property stops working if we remove the absolute positioning of the element.position:absolute
you can also use position:fixed
, since, according to the documentation, the fixed elements also qualify as “absolutely positioned”. .example { border: 1px solid black; }
border
property combines the values ​​of the border-width
, border-style
and border-color
properties into a single construct. But do not forget that each of the properties whose value the border
contains is itself an abbreviated record. So, for example, border-width
can be written as follows: .example { border-width: 2px 5px 1px 0; }
border-style
and border-color
properties. Something terrible can be obtained: <div class="box"></div> <p>Please don't ever do this.</p>
body { font-family: Arial, sans-serif; } .box { width: 150px; height: 150px; margin: 20px auto; border-color: peachpuff chartreuse thistle firebrick; border-style: solid dashed dotted double; border-width: 10px 3px 1px 8px; } p { text-align: center; }
border-left-style
, border-top-width
, border-bottom-color
and so on properties.border
you can not set different values ​​for different sides. Thus, it turns out something like an abbreviated notation within an abbreviated notation within an abbreviated notation.text-decoration
property is now abbreviated a { text-decoration: overline aqua wavy; }
text-decoration-line
, text-decoration-color
and text-decoration-style
. Unfortunately, Firefox is the only browser that supports new features, but at the same time (apparently, to ensure backward compatibility) does not support abbreviated syntax.text-decoration
property and simply skip it. This is not good in terms of backward compatibility.border-width
property supports key values.5px
or 1em
), border-width
supports three key values: medium
, thin
and thick
.border-width
property is medium
. The thick
value is shown below:1px
, 3px
and 5px
respectively.border-image
”border-image
property on SitePoint . It is supported by all modern browsers, with the exception of IE 10 and below. But who cares?border-image
is a very funny property that allows you to frame a container with a certain image.border-image
is one of the new, insufficiently popular. Although maybe I'm wrong. If you have examples of using border-image
, welcome to comments!empty-cells
table { empty-cells: hide; }
font-style
property supports oblique
normal
and italic
. But there is also oblique
.... selects a font marked oblique, otherwise italic.
oblique
value is interchangeable with italic
(as stated in the specification) as long as the font used does not have a separate oblique outline.font-style:italic
property will actually show us the value of the font-style:oblique
property.word-wrap
is the same as overflow-wrap
word-wrap
property is used less frequently, but in some cases it may be useful. A very common example is breaking up a long, continuous line of text to avoid going out of the container.word-wrap
property with overflow-wrap
: they apparently thought the former name was wrong. overflow-wrap
has the same meaning as word-wrap
, and the latter is now regarded as an "alternative".overflow-wrap
still not very common, you shouldn’t worry, because we can still use word-wrap
: browsers support it also for backward compatibility.overflow-wrap
, there when all the popular browsers are updated, but for now I see no reason to change something.Source: https://habr.com/ru/post/220237/
All Articles