Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

background position for background color

Tags:

css

Im able to give the start position of an background image. But if i give positions for solid fill background its not working. Here is the js fiddle for that.

http://jsfiddle.net/yPVJE/

So can we set the start position and the size of an solid fill backgrounds?

Thanks!

like image 758
Rajkamal Subramanian Avatar asked Dec 19 '11 07:12

Rajkamal Subramanian


People also ask

What is background image position?

The background-position property sets the starting position of a background image. Tip: By default, a background-image is placed at the top-left corner of an element, and repeated both vertically and horizontally.

How is background position calculated?

The four-value syntax for background-position You combine length values with any of top/right/bottom/left keywords (not center). So for our example: background-position: right 20px bottom 10px; Using this, you can offset a background-image from any of the four corners of an element.

How do you change the background color in CSS?

You can change the background color of an HTML element using the background-color CSS property and giving it a value of a color. With this code, the paragraphs are given a pink background.

What is background position in computer?

Background PositionThe background-position property specifies the initial position where the background image will be placed inside of the element it is the background for. You can set both the horizontal and vertical position. Options for setting the horizontal position are left, right and center.


1 Answers

I would take a similar approach to StuR, but using background position instead of gradient points. You can then set your background position as you would usually.

div {   background:linear-gradient(left, #000, #000) no-repeat 50px 50px; } 
like image 98
Ash Avatar answered Oct 21 '22 12:10

Ash