Home >Web Front-end >Front-end Q&A >What should I do if the css right attribute does not work?

What should I do if the css right attribute does not work?

藏色散人
藏色散人Original
2021-01-06 11:03:442861browse

css The right attribute does not work because the value of the position attribute of the element is static. The solution is to change the value of the position attribute of the element to any one of relative, absolute, and fixed.

What should I do if the css right attribute does not work?

#The operating environment of this tutorial: Windows 7 system, css3 version, Dell G3 computer.

Recommended: "css video tutorial"

Solution to the problem that the css right attribute does not take effect

The css right attribute does not take effect This is because the value of the position attribute of the element is static. The solution is to change the value of the position attribute of the element to any one of relative, absolute, and fixed.

The right attribute specifies the right edge of the element. This property defines the offset between the right margin edge of the positioned element and the right edge of its containing block.

Note: If the value of the "position" attribute is "static", then setting the "right" attribute will have no effect.

Example:

img {
    position:absolute;
    right:5px;
}

Sets the right edge of the image 5 pixels to the left of the right edge of its containing element.

The above is the detailed content of What should I do if the css right attribute does not work?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What does css cut mean?Next article:What does css cut mean?