EXIT CSS

When you do not want to write css.




(Strategy applied on Agile Product Dev. team)

 




Answer the Question

Please!


How many are Backend developers here
who don't want to mess the code written in stylesheets?




OK Folks! 



Count Noted
Let us assume, we have good number to start this presentation




UI Frameworks

(Grids, Typography, UI widgets, Sleek UIs controls)





Philosophy behind UI Frameworks


  • It is about CODE::Discipline! with agreed visual guideline.

  • Reusable UI components works great.

  • No one likes to mess up with controls for ever, the controls should have functionality reliability restored into them.

  • You need a component, pick and place the code and let it work automatically

Dialogue...

Lets, have a take on CSS frameworks... 
Any application having a good layer and backbone of consistent Visual design, in which it is been agreed..how different tag, form elements and rich UI controls, how will they render themselves in different browsers.

Any application whether it is 3 pages site or if that is 30,000 pages site or application. 
From code consistency purpose, which further translates itself into visual consistency.

As long as the code is kept consistent in the framework and which further agreed by developers when the same code guidelines will be used, visual consistency can be maintained.

Backend or core developers don't bother much about how the application will look, what they are more keen into
whether the supported framework or html+css+js code, can support the functionality they have been taking care of.
Continued... 

...Continued

With these UI frameworks, since the application look and feel is maintained and kept consistent. Backend Developers need not much to bother about the code in JSP at front end. Staying away from inline css, embedded code and 
reusing the existing code base is highly encouraging practice. 
Inline css code and embedded css code... kill the design aesthetics and UI interaction.

For which all backend developers, should not create a mess with it. Specifying their own version of visual appearance.

If they also believe in the fact, that the application they are working upon and developing... will serves an ideal source of bread and butter for ages to come, including themselves also. And they can roll out quick updates effectively, rather then having using an Just-in-time fix.  With little precaution and code discipline, Deployments and updates rolling can be made safer and smoother.

The power of reusable framework codebase, provides the user interface expert or the user experience designer the CONFIDENCE, in accomplishing their goals.

As the code guidelines effective usage is followed.
The concern, with these frameworks appears at visual level.. for e.g if we user Twitter Bootstrap.. the whole world may began to smell like Twitter bootstrap.

What if the local vendor, client want to the provide the branding test and dress the application in their way of thinking and style.
BINGO! You are safe.. as long as you know and understand the markup. And can create variety of mocks for the visual design based on existing widgets (drop down, color picker, date picker, modal window, multiselect drop down etc)  

Back to THE POINT

From Audience: Ok you mean, that we can used the existing markup. which further bind itself via Tags, Classes and IDs and give consistent look (presentation)

and the consistent interaction behaviour can be maintained by using javascript code supplied by the framework.

... From Audience: Ok! great.. But if that much is sufficient.... sometimes, being a JSP developer we need to come up with own css rules, if they can be modularized or maintained. What if we want to override the existing codebase at very minute level. 
. 
Presenter:
Yeah, you can always override the existing stuff which has been thoughtfully provided to you. 
But overriding is done in a way
So, that i won't hurt/kill you back. 

Also, you can create some classes either via CSS or SASS codebase.
Let me show you by examples... 

instead of overriding the complete css rules, individual property can be set to overriding  mode
and the same.. can be added into JSP and can be reused in multiple fashion... 

Thus, JSP developers need not much to dig  in their hands into stylesheets... for some nifty pixel tweaking they have classes which are available

Extending the Framework's codebase



You always get something from framework. 
but according to your programming style, you may find yourself
dependent on certain css visual declarations.
So, we are extending the framework code and including those as an extension to codebase
for e.g.

Code Samples

         
/* reusable stuff, like LEGOS */

/* div,p and block elements is viewed as display:block by default */
/* you can change there visual rendering in a line, just like span tag..
by assigning the property display:inline with the help of class */ 

.block-in,.block-inline {
    display: inline
}

.block {
    display: block
}

.block-in-b {
	display: inline-block
}


/* to hide the tag, at visual level */
.block-no {display: none}


/* The tag will be hidden, but it will occupy some height */

.visi-hide {visibility: hidden;}

/********/

.float-l {
	float: left !important
}

.float-r {
	float: right !important;
}

.clear-cf {
	float: none;
	clear: both;
}

/* .clearfix{} is also good to use */

...Code Sample (continued)

             
/* For text alignment*/            
.txt-l {text-align: left}
.txt-r {text-align: right}
.txt-c {text-align: center}

/* reusable margins & padding */

/* padding:1px */
.p-1 { padding: 1px;}
.p-t1 { padding-top: 1px;}

/* padding:2px */
.p-2 {padding: 2px;}
.p-t2 {padding-top: 2px;}
 

/* padding:10px */
.p-10{padding:10px;}

.p-t10 {padding-top: 10px ;}

.p-b10 {padding-bottom: 10px;}

.p-l10 {padding-left: 10px;}

.p-r10 {padding-right: 10px;}

 
/**/

.m-b1{margin-bottom:1px;}
.m-t2 {margin-top: 2px !important;}
.m-t3 {margin-top: 3px;}
.m-b3 {margin-bottom: 3px}
.m-5 {margin: 5px;}
 


/* Reset margins and padding selectively */

.reset-m {margin: 0 !important}

.reset-m-l {margin-left: 0 !important}
.reset-m-r {margin-right: 0 !important}
.reset-m-t {margin-top: 0 !important}
.reset-m-b {margin-bottom: 0 !important}

/* Padding */

.reset-p {padding: 0 !important}
.reset-p-l {padding-left: 0 !important}
.reset-p-r {padding-right: 0 !important}
.reset-p-t {padding-top: 0 !important}
.reset-p-b {padding-bottom: 0 !important}

Code continued...



/* auto width for select html tag */

.auto-width select{width:auto;}
/* Reseting the border and Reseting the border-radius classes **/

.no-border {border: 0 none !important;}

.no-border-radius {
	-moz-border-radius: 0 !important;
	-webkit-border-radius: 0 !important;
	-khtml-border-radius: 0 !important;
	border-radius: 0 !important;
}


.no-btl{
	border-top-left-radius	:0;
	-moz-border-radius-topleft :0;
	-webkit-border-top-left-radius:0;
}

.no-btr{
	border-top-right-radius :0;
	-moz-border-radius-topright :0;
	-webkit-border-top-right-radius:0;
}

.no-bbl{
	border-bottom-left-radius :0;
	-moz-border-radius-bottomleft :0;
	-webkit-border-bottom-left-radius:0;
}

.no-bbr{
	border-bottom-right-radius :0;	
	-moz-border-radius-bottomright :0;
	-webkit-border-bottom-right-radius:0;
}

/**/

.border-radius-5 {
	-moz-border-radius: 5px !important;
	-webkit-border-radius: 5px !important;
	-khtml-border-radius: 5px !important;
	border-radius: 5px !important;
}
            

Reusing The... # and .

See, how these limited number of classes, can be reused and can provide different combination of visual rules.
 <div class="footer-container">
	<div class="p-t10 p-b5 ">
	<div class="row-fluid foot-inner">
	<div class="span6 ">
				
	<div class="block-in-b key-pop p-r20 p-l20">
       <input type="checkbox" id="hotkeys"checked name="uni_c1"
class="uni_style tip"></input> 

<a class="popover-link color-white" data-toggle="popover" title=" <spring:message code="label.hotkeys" />" data-placement="top"> <spring:message code="label.hotkeys" />
</a>
</div>
</div>
</div>
</div>

Outcome

The advantage of having this kind of modularity
is, the you as developer become the author of classes and id
when you embed them into your markup.
Support technology for those theming templates may vary.

So, rather adding shitty lines of code into your stylesheets. It is better to get out and decrease dependency onto your stylesheets.

Maintaining code is hard, when your enterprise application getting monstrous day by day. Better is that you prefer to working in stingy coder fashion. 



Thank you!



Exit CSS

By Gaurav Mishra

Exit CSS

Why I do not like to write css, instead getting away from stylesheets. Focussing on markup and using the classes and id and reusable components. Just like author use verbs, nouns or adjectives to construct its sentence.

  • 4,349