How to paint a background image with CSS

1

Does anyone know how I do this yellowish effect in CSS in the photo?

    
asked by anonymous 24.05.2017 / 02:31

1 answer

3

You can use linear-gradient and choose the color you want. In this answer you can see other examples with different colors.

div {
  height: 200px;
  width: 300px;
  background:
    linear-gradient(rgba(255,255,0,.5),rgba(255,255,0,.5)),
    url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxITEhISEhMVFRUWFRoXFxUXFRUVGBcVGBcWFhUXFxcYHSggGBolGxUXIjEhJSkrLi4uFx8zODMsNygtLisBCgoKDg0OGxAQGi0lHyYxLS8tLS0tLTcrLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS4tLf/AABEIALIAzwMBIgACEQEDEQH/xAAcAAEAAgMBAQEAAAAAAAAAAAAABAYCAwUHAQj/xAA8EAABAwIEBAMFBwIFBQAAAAABAAIDBBEFEiExBkFRYRNxgQciQpGxIzJSodHh8BSSM3KCwfEWJENTYv/EABkBAQADAQEAAAAAAAAAAAAAAAACAwQBBf/EACQRAAICAgMAAgIDAQAAAAAAAAABAhEDIQQSMRMiUWGBocFB/9oADAMBAAIRAxEAPwD3FERAEREAREQBERAEREAREQBERAEXwla3TDkuN0dSs2oo39Qvoqeqj3R3oyQiwEo6rIOClaOUz6iIunAiIgCIiAIiIAiIgCIiAIiIAiIgCItU0wC43R1KzYStL6joopmudVlcKv5L8LOleh0pJXyRyxMrQsS8HmFC0SoF3yWpxSVxC+MeqpFsT42YrYye60yNutUUmtiqu7RZ1TJoqSFLpawONjuuTVDS4XzCATKDfTX52VkMzUkiuWJOLZYURFuMYREQBERAEREAREQBERAEJXwlRpZua43R1Kz7PUW0CgSSrTJUarBz+qySn2NUYdT66VZNquqjPWsX/NRTaJNJmGJxPkbaN2Ug7+m3kuRK+rjbsyTuCR66/Rd9p3WZiB3TomdWRx0Ueh4vljfknjLR31B/ylXCgrGStzMPm07hRsSwVkjSCLqpPjlon31Md9/w+fVqqlB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TeiXBTtb90AeQWydosQdlHpqu/mqZ7ReKfCZ/TxO+1lOUkfCw6P9bc13BysefD8uJ2v9/DDg+3VnIxiva58kg1bmOW34QbX8tF0MKrDlGY6HYAddQfkqtiD2xUmgu53ujqdhYfP81aMGym2nwajoQ0Bvy+qwQhJLbPTdVR0KjGDDJGxxFnmwPpseisFLV3F7ajcLz/imo/7+igB0cA8j/UR/sr7TANa4n4QbnyF1phaZnyU0dujqA9t9lIXIwCYPYCF11sg7VmOaqVBERTIBERAEREAREQBERAQcSZoDyvquO0CxA33+f7hWKaPMCFWqqlljlc8sJjLDdzdbEbab63PJUzhbsvxz1RycYYM0E4NjC/JJ/kksHX7XyldqGpGQuJAsedhfqvL8S4yn8R7PCe6G/8A6ZBIeRadNtFtroqysNKKeOfJZxccuWzjZtn5rEXABUFi3stc01os0lVDTuIik905n+GXbE3Pu9rjZU+t44j/AKoPja4MLQJLjXMNyOulvkrdhXs9e5wkqCD7uUMuTYdS7mdVYKTgGjYQfBj/ALf1UliIzyI5WB8TU8rQWzR36F1iPMFdCoroBq6eNvm4fqu3Hw1Rjani/sat7cFphtBF/Y39FHk8TFyY9cqtFEZuLtHnuK8X2jc2kY+Z5H3g0ho/1G1/ReVV08/jeLO19+dwdPLsv007C4T/AONvyUabh6ncLFg/nmp4sEMcFCCpL/hLvuz87s4kbePNtqdeXL/ZWXh7H2Ok8JjrvcRYWNjbU+lgV6TV+zbDpDd0I9Db6KJT+ynDY3iRjJA5puLSv+l9V14kyxZ2U3iKdoxSOa4LY4IwSexkc4eeqv1FUMfBI1zgS5rszW7hrwS0ednLeeBKI3Log4ncuLjf811qHBYYhaNjW+Q9NTzXFi2cllTVHC9nkUjYnCQODhb73MagH5BW5YtaBsslZGPVUVTl2lYRfAV9UiAREQBERAEREAREQBERAYlg6BZWREAREQBERAEREAREQBERAEREBqiW1EXWdYREXDgREQBERAEREAREQBERAEREAREQBERAEREAREQBERAf/9k=) no-repeat;        
}
<div></div>

Whenever you use a property, remember check browser compatibility .

    
24.05.2017 / 03:42