Animate CSS background-position with smooth results (sub-pixel animation)

Checkout this example: #content { height: 300px; text-align: center; font-size: 26px; color: #000; position:relative; } .bg{ position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -1; background: url(http://www.gstatic.com/webp/gallery/1.jpg) 0% 0% repeat; animation-name: MOVE-BG; animation-duration: 100s; animation-timing-function: linear; animation-iteration-count: infinite; } @keyframes MOVE-BG { from { transform: translateX(0); } to { transform: translateX(-187%); } … Read more

How to completely remove borders from HTML table

<table cellspacing=”0″ cellpadding=”0″> And in css: table {border: none;} EDIT: As iGEL noted, this solution is officially deprecated (still works though), so if you are starting from scratch, you should go with the jnpcl’s border-collapse solution. I actually quite dislike this change so far (don’t work with tables that often). It makes some tasks bit … Read more

How to add a background image on top of a previous background image?

You can consider CSS variables. Specify 2 background layer that you can change later. You can easily scale to any number of background: .container > div { background: /*we make the default value a transparent image*/ var(–im1,linear-gradient(transparent,transparent)), var(–im2,linear-gradient(transparent,transparent)); height:200px; width:200px; display:inline-block; } .background1 { –im2: url(https://picsum.photos/200/300?image=0); } .background2 { –im2: url(https://picsum.photos/200/300?image=1069); } .backgroundFilter { –im1: … Read more

How to change SVG color when it is an encoded CSS background image?

You can use the filter property: .box { background: url(“data:image/svg+xml,%3Csvg xmlns=”http://www.w3.org/2000/svg” viewBox=’0 0 511.999 511.999’%3E%3Cpath fill=”red” d=’M83.578 167.256H16.716C7.524 167.256 0 174.742 0 183.971v300.881c0 9.225 7.491 16.713 16.716 16.713h66.862c9.225 0 16.716-7.489 16.716-16.713V183.971c0-9.229-7.525-16.715-16.716-16.715zM470.266 167.256c-2.692-.456-128.739 0-128.739 0l17.606-48.032c12.148-33.174 4.283-83.827-29.424-101.835-10.975-5.864-26.309-8.809-38.672-5.697-7.09 1.784-13.321 6.478-17.035 12.767-4.271 7.233-3.83 15.676-5.351 23.696-3.857 20.342-13.469 39.683-28.354 54.2-25.952 25.311-106.571 98.331-106.571 98.331v267.45h278.593c37.592.022 62.228-41.958 43.687-74.749 22.101-14.155 29.66-43.97 16.716-66.862 22.102-14.155 29.66-43.97 16.716-66.862 … Read more

Background Image Placement

You’ll have to create a custom bitmap drawable with your bitmap in an XML file (eg “res/drawables/my_drawable.xml” <?xml version=”1.0″ encoding=”utf-8″?> <bitmap xmlns:android=”http://schemas.android.com/apk/res/android” android:src=”https://stackoverflow.com/questions/2781593/@drawable/my_png_file” android:gravity=”bottom|left” /> And then set this drawable xml as your view’s background (“@drawables/my_drawable”). The drawable XML format is very poorly documented in the Android site, though, so it’s definitely not an easy … Read more

background-size: cover not working on iOS

This happens, particularly on iOS, when you have background-attachment:fixed. On mobile, I usually put background-attachment:scroll inside of a @media query. As @RyanKimber pointed out, fixed attached images use the whole <body> size. On mobile this can get really tall which blows your image out. Setting the attachment back to scroll allows your cover image to … Read more

Android: textColor of disabled button in selector not showing?

You need to also create a ColorStateList for text colors identifying different states. Do the following: Create another XML file in res\color named something like text_color.xml. <?xml version=”1.0″ encoding=”utf-8″?> <selector xmlns:android=”http://schemas.android.com/apk/res/android”> <!– disabled state –> <item android:state_enabled=”false” android:color=”#9D9FA2″ /> <item android:color=”#000″/> </selector> In your style.xml, put a reference to that text_color.xml file as follows: <style … Read more

Symfony2 – Assetic – load images in CSS

use the cssrewrite filter from Assetic bundle In config.yml: assetic: debug: %kernel.debug% use_controller: false filters: cssrewrite: ~ And then call your stylesheets like this: {% stylesheets ‘bundles/cmtcore/css/*’ filter=”cssrewrite” %} <link rel=”stylesheet” type=”text/css” media=”screen” href=”https://stackoverflow.com/questions/7044631/{{ asset_url }}” /> {% endstylesheets %} Oh and don’t forget to use php app/console assetic:dump