Home>Article>Web Front-end> How to set the distance of the image from the left in css

How to set the distance of the image from the left in css

青灯夜游
青灯夜游 Original
2021-11-09 15:02:49 7194browse

In CSS, you can use the margin-left attribute to set the distance from the left side of the image. The function of this attribute is to set the left margin of the element. You only need to add "img{margin-left: distance value" to the image element. ;}" style is enough.

How to set the distance of the image from the left in css

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

In CSS, you can set the distance from the left side of the image through the margin-left attribute.

The margin-left attribute sets the left margin of the element. Negative values are allowed.

Example:

    
How to set the distance of the image from the left in css How to set the distance of the image from the left in css

Rendering:

How to set the distance of the image from the left in css

Description:

margin-left attribute value Units can use px, %, em, rem, etc.

(Learning video sharing:css video tutorial)

The above is the detailed content of How to set the distance of the image from the left in css. 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