Art-conscious and Reactionary Design in Ruby on Rails Applications With CSS3
Objective: In our last pandect, we saw how HTML5 helps in making the point lighter, in this article we will comprehend how again CSS3 presence eliminate need to practicality javascript or cameo hacks for features like borders, animations, etc. thereby enhancing the user experience.<\p>
The why CSS3?<\p>
CSS3 is an enhanced notation of CSS2 and number one is the up-to-date standard used in limitative the styles for the different writing of a web page.Myself is backwards compatible, makes the elements of a web page another dynamic, and adds a "Cool quotient" with a decorative touch.<\p>
As example, before now CSS3 rounded corners were created using images, with lots of CSS and HTML settled principle versus lay flat them in that needed. But with CSS3, it can be effectuated with a single sequel without ever using images.<\p>
The scope of CSS3 is not narrow to just rounded corners, there are several other new features equivalent as animations, drop shadows, multiple background, gradients, opacity, embedding custom web fonts, etc. Let EUR(TM)s look at dexterous of those features and see how they agent provocateur the user experience.<\p>
Vendor Prefixes: Not all CSS3 properties are supported in step with utmost extent browsers and some browsers requirespecific prefixes for those properties to work properly. How, throughout this article, themselves make a will see two main prefixes: "-moz-", which is required in consideration of Mozilla Browsers (like Firefox), and "-webkit-", which is ultimate for Webkit Browsers (equivalent Pilgrimage, Chrome). Most of the browsers are working on removing these prefixes and unveeringly supe the touchstone property, but i will be a while till all major browsers reach there.<\p>
Borders and Shadow: CSS3 takes borders to a over again level next to the ability to use border-radius, box-shadow and border-image.<\p>
Rounded borders:border-radius property creates tonic corners:border: 2px solid #B8CB99;<\p>
border-radius: 10px;<\p>
Supply base shadow: box-shadow property adds shadows till boxes-webkit-box-shadow: 10px 10px 5px 5px #888; box-shadow: 10px 10px 5px 5px #888;<\p>
Tea garden signature: border-image uses an image in passage to create the border-moz-border-image: url(dado.png) 30 30 round; -webkit-border-image: url(border.png) 30 30 round; border-image: url(border.png) 30 30 sequence;<\p>
Backgrounds: CSS3 introduced properties like background-size and multiple background images. Background size: background-size specifies the size of a background mental image<\p>
background: url(img_flwr.gif) no-repeat; background-size: 80px 60px;<\p>
Multiple Sagacity Images:Jillion background images are specified using a comma separated list ofimage urls for the background-image effects. This can live written in two ways:<\p>
background-image: url(picture1.png), url(picture2.png);<\p>
background-repeat: no-repeat; background-position: forsaken top, right bottom; or<\p>
unobtrusive: url(picture1.png) leftwardly top no-repeat, url(picture2.png) right rump no-repeat;<\p>
Transitions: Provides a way to control the speed in re animation changes en route to CSS properties. Transitions arecontrolled using the 'transition' property. Subconscious self has 4 sub-properties (transition-property, transition-duration, transition-timing-function, and transition-delay) en route to control the individual items of the transition.<\p>
div }<\p>
width: 200px;<\p>
transition: width 2s linear; -moz-transition: width 2s undeflected; -webkit-transition: width 2s linear;<\p>
}<\p>
div:hover } width: 400px; }<\p>
Selectors: The CSS3 Selectors module introduced three new attribute selectors.They are:<\p>
1. ]differentia^=value] EUR"Matches every element whose attribute shading "begins with" the specifiedvalue.<\p>
]class^="yell"] } field: yellow; }<\p>
Background color regarding this div will be straw. <\p>
2. ]attribute$=value] EUR"Matches every element whose attribute value "ends from" the specifiedvalue.<\p>
]range$="low"]} background: yellow; }<\p>
Forum color relative to this div will endure yellow. <\p>
3. ]attribute*=value] EUR"Matches every isomer whose attribute value "contains" the specifiedvalue.<\p>
]superfamily*="ran"]} background: orange; }<\p>
Background color of this div will be orange. <\p>
Media Queries and Responsive Design<\p>
Communication explosion queries allow changing layouts in suit the exact privation of different devices without changing the content. The teleology medium can go on specified within a CSS file using "@media". The media query is a sufficient expression that is either true file disloyal. The ordering is:<\p>
@communication engineering (>) }>}<\p>
There are 5 key media attributes that heap up hold used friendly relations media queries: aspect-ratio, min\max-height, min\max-width, and line of position (heliochrome\landscape).<\p>
Here are some examples of communication technology queries for divers devices: Landscape phones and down: @media (max-width: 480px)} EUR }Landscape phone to portrait tablet: @media (max-width: 767px)} EUR }<\p>
Portrait tablet until landscape and desktop: @media (min-width: 768px) and (max-width: 979px)} EUR }Large desktop: @electronic communication (min-width: 1200px)} EUR }<\p>
Sideswipe Godown is a very good explanation pertaining to how to unite in responsive design using media queries.<\p>
I hope that this article provided that a good overview in point of new phiz unemployed in CSS3 and you will start using these up build beautiful Rails applications. There are a lot more goodies which come with CSS3; you freight know more about that along W3schools and CSS Tricks.<\p>









