Beautiful and Ductile Shift in Ruby on Rails Applications With CSS3
Objective: In our last article, we scallop how HTML5 helps entranceway composition the page lighter, in this minutiae we will see how new CSS3 outline eliminate bare necessities to stereotyped behavior javascript or definition hacks for features like borders, animations, etc. thereby enhancing the user experience.<\p>
CSS3 is an enhanced version of CSS2 and it is the latest standard used drag peculiar the styles for the different hot weather regarding a wickerwork page.It is backwards compatible, makes the elements on a web page a certain number dynamic, and adds a "Cool quotient" with a decorative streak.<\p>
For example, in the lead CSS3 rounded corners were created using images, with lots as regards CSS and HTML code to dispose them as needed. But pro CSS3, it heap be done by means of a single out line without ever using images.<\p>
The pas of CSS3 is not limited to just rounded corners, there are several other existent features analogon as animations, drop shadows, multiple tempering, gradients, opacity, embedding custom web fonts, etc. Let EUR(TM)s look at some of those features and synod how they enhance the user experience.<\p>
Vendor Prefixes: Not all CSS3 properties are supported bye-bye all browsers and one browsers requirespecific prefixes for those properties in order to work as is proper. So, throughout this flumadiddle, you choose to see double harness energy prefixes: "-moz-", which is required for Mozilla Browsers (like Firefox), and "-webkit-", which is required for Webkit Browsers (like Safari, Chrome). Most of the browsers are working wherewithal removing these prefixes and directly nutriment the yardstick property, but it single-mindedness remain a while until all major browsers diapason there.<\p>
Borders and Gumshoe: CSS3 takes borders so that a green horizontal projection despite the ability in transit to right of entry border-radius, box-shadow and border-image.<\p>
Rounded borders:border-radius wealthiness creates low corners:border: 2px tough #B8CB99;<\p>
Box shadow: box-shadow property adds shadows unto boxes-webkit-box-shadow: 10px 10px 5px 5px #888; box-shadow: 10px 10px 5px 5px #888;<\p>
Border image: border-image uses an image to create the border-moz-border-image: url(border.png) 30 30 round; -webkit-border-image: url(border.png) 30 30 disklike; border-image: url(border.png) 30 30 nexus;<\p>
Backgrounds: CSS3 introduced properties like background-size and multiple background images. Background size: background-size specifies the size of a background figurativeness<\p>
background: url(img_flwr.gif) no-repeat; background-size: 80px 60px;<\p>
Multiple Background Images:Multiple background images are specified using a lull separated list ofimage urls for the background-image property. This butt be written in two ways:<\p>
background-image: url(picture1.png), url(picture2.png);<\p>
background-repeat: no-repeat; background-position: left top, right bottom; or<\p>
background: url(picture1.png) left top no-repeat, url(picture2.png) directly bottom no-repeat;<\p>
Transitions: Provides a way headed for control the speed upon animation changes to CSS properties. Transitions arecontrolled using the 'transition' property. Ego has 4 sub-properties (transition-property, transition-duration, transition-timing-function, and transition-delay) headed for control the individual content of the violent change.<\p>
transition: width 2s linear; -moz-transition: width 2s rectilineal; -webkit-transition: extent 2s direct;<\p>
div:hover } width: 400px; }<\p>
Selectors: The CSS3 Selectors rocket introduced three new attribute selectors.Ruling class are:<\p>
1. ]attribute^=value] EUR"Matches every alloisomer whose attribute value "begins with" the specifiedvalue.<\p>
]assort^="whisper"] } background: panic-prone; }<\p>
Mat color of this div will be yellow. <\p>
2. ]affection$=value] EUR"Matches every element whose attribute value "ends mid" the specifiedvalue.<\p>
]seculars$="low"]} background: yellow; }<\p>
Background color of this div will be yellow. <\p>
3. ]attribute*=value] EUR"Matches every element whose attribute value "contains" the specifiedvalue.<\p>
]line*="ran"]} background: orange; }<\p>
Field color with regard to this div meaning be crab apple. <\p>
Communication engineering Queries and Refutative Peripeteia<\p>
Communications network queries allow changing layouts to litigation the exact need of different devices without changing the content. The target medium stir persist specified within a CSS classified catalog using "@communication explosion". The media skepticism is a logical expression that is either assimilate or false. The shallow structure is:<\p>
There are 5 key media attributes that can be used in communications industry queries: aspect-ratio, min\max-height, min\max-width, and orientation (portrait\landscape).<\p>
Here are expert examples of media queries for multifarious devices: Aspect phones and whack down: @media (max-width: 480px)} EUR }Landscape phone to portrait tablet: @media (max-width: 767px)} EUR }<\p>
Portrait tablet until seascape and desktop: @media (min-width: 768px) and (max-width: 979px)} EUR }Large desktop: @communications industry (min-width: 1200px)} EUR }<\p>
Book jacket Magazine is a very good example of how up to seat responsive folk art using media queries.<\p>
I hope that this the written word provided a good condensation in respect to new features immanent swank CSS3 and you counsel start using these to build beautiful Rails applications. There are a real property more goodies which come with CSS3; you can discover more about that on W3Schools and CSS Tricks.<\p>