Usage of background-position property in CSS

JavascriptWeb DevelopmentFront End Scripts

<p>The <em>background</em>-<em>position</em> property is used to control the position of an image in the background.</p><h2>Example</h2><p>You can try to run the following code to learn how to work with the <em>background-position</em> property. It sets the background image position 30 pixels away from the left side:</p><pre class="prettyprint notranslate">&lt;html&gt; &nbsp; &nbsp;&lt;head&gt; &nbsp; &nbsp; &nbsp; &lt;style&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;body { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; background-image: url(&quot;/css/images/css.jpg&quot;); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; background-position:30px; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} &nbsp; &nbsp; &nbsp; &lt;/style&gt; &nbsp; &nbsp;&lt;/head&gt; &nbsp; &nbsp;&lt;body&gt; &nbsp; &nbsp; &nbsp; &lt;p&gt;Tutorials point&lt;/p&gt; &nbsp; &nbsp;&lt;/body&gt; &lt;/html&gt;</pre>
Updated on 30-Jan-2020 08:53:42