Search code examples
htmlcssbackground-color

How to color a div half blue, half yellow?


Please, help me to find the easiest way to achieve this result with just one single div?

<div></div>

enter image description here


Solution

  • You can do this:

    Here is the JSFiddle demo

    Snippet Example

     div{
        	width:400px;
        	height:350px;
        	background: linear-gradient(to right, blue 50%, yellow 50%);
        }
    <div></div>