Skip to main content

Posts

Showing posts from August, 2013

SASS - Nesting the CSS

    To begin with SASS we need Ruby to be installed on our machine. To set up Ruby and SASS on your machine refer to the following steps.     If you’re using OS X, you’ll already have Ruby installed. Windows users can install Ruby via Windows installer , and Linux users can install it via their package manager. Once you have Ruby installed, you can install Sass by running: gem install sass     To translate your Sass file into a CSS file, run sass --watch style.scss:style.css     Now whenever you change style.scss, Sass will automatically update style.css with the changes. Later on when you have several Sass files, you can also watch an entire directory: sass --watch stylesheets/sass:stylesheets/compiled     We don't need to do so many things to get up and running. We just need our good old friend jsFiddle. We will take a look at the various features of SASS today onward. Let's discuss the most basic and an important feature today - Nesting. In all I will be cove

SASS: Syntactically Awesome Stylesheets - An Introduction

    I had some free time today, and decided to explore into SASS, which I had planned on doing for a long time. SASS is really cool and it really is simple styling with a lot of attitude. SASS really makes CSS so much fun. I loved it and am putting up a few posts to talk about the various features of SASS.     SASS is an extension of CSS3, adding nested rules, variables, mixins, selector inheritance and much more. The SASS CSS is required to be compiled before it is transformed into standard CSS using a command line tool or a web-framework plugin. Let's not worry about this for now.     SASS CSS can be written using 2 types of syntaxes. The most popularly used syntax is known as "SCSS", rightly named " Sassy CSS" and is a superset of CSS3's syntax. This means that every CSS3 stylesheet is valid SCSS as well. The second syntax is an older one known as the "indented syntax" or just SASS. This syntax is for people who do not love brackets and

Jquery Mobile Buttons

    Buttons - an integral part of a form is styled really well and consistently using the Jquery Mobile framework. We will discuss and take a look at the different buttons, their styling and usage in today's post. Buttons are coded with standard HTML anchor and input elements, then enhanced by Jquery Mobile to make them more attractive and touch friendly for mobile usage. Let's discuss this and more in the example that follows.     You must have already observed that the styling for the first 5 buttons is the same, even though the HTML markup for each is different. The first one is created using an anchor tag. The next one using a button  element and further using input elements of type button , submit and reset . To create a button out of the anchor element, you need to include a data attribute data-role="button" with the anchor element. The framework now styles the anchor element as a button. Now the question arises as to when to use a anchor based button and

Jquery Mobile Form - Select Menus Part II

    In part II of this tutorial on creating select menus using Jquery Mobile, we will discuss some customization techniques like overriding the default native OS select menu or disabling an option or creating a multi-select select box. It is advisable that you take a look at part I of this tutorial where we have discussed the basics of the select menu. In case you have decided to proceed with this part, then we are ready to take a look at the code that follows.     In the example code above, you will observe 2 different selects. We will be discussing the following data attributes and HTML5 properties that will enhance the select menus further. 1. data-native-menu="false" 2. data-placeholder="true" 3. disabled 4. multiple     As seen in the first implementation, by adding the data attribute data-native-menu="false" we can simply override the native OS menu control and display a pop-up containing the options in a listview. If there are a large

Jquery Mobile Form - Select Menus Part I

    Today we will take a look at the select boxes styling and usage using Jquery Mobile. Select menus has a little more explanation and examples than other controls and so I am dividing the select menus tutorial into 2 parts. In the first part, we will take a look at the basics of the Jquery Mobile select menus and in the second part we will take a look at the more complex examples involving the select menus.     The Jquery Mobile select menu is based on the native HTML select element, which is styled and modified to suite the Jquery Mobile framework's style. By default, the framework leverages the native OS options menu to use with the custom select button.  When the button is clicked, the native OS menu will open. When a value is selected and the menu closes, the custom button's text is updated to match the selected value. The framework also offers the possibility of having custom (non-native) select menus; which we will discuss in part 2 of this tutorial. Refer to the s

Jquery Mobile Form - Checkboxes

    Checkboxes - popularly used in forms for multi-option selection, pose a problem in the mobile web world! The checkboxes being so small as they are, reduce the touch area and it becomes really difficult for selection. Jquery Mobile styles these checkboxes in such a way that they become touch friendly and gel with their overall framework design. Jquery Mobile styles the label for the  checkboxes  so that they are larger and clickable. A custom set of icons representing the  checkboxes  is added to provide additional visual feedback.     The  checkboxes  can be used singularly or in a vertical group or can be even grouped horizontally. These  checkboxes  can be used along with data-mini="true" too, which renders the  checkboxes  in a smaller size. We will take a look at all this in the example that follows.     In the first implementation you will see, 3 singular  checkboxes  which are not attached to each other like in the second implementation. These 2 implem

Jquery Mobile Form - Radio buttons

    Radio buttons - popularly used in forms for single option selection, pose a problem in the mobile web world! The radio buttons being so small as they are, reduce the touch area and it becomes really difficult for selection. Jquery Mobile styles these radio buttons in such a way that they become touch friendly and gel with their overall framework design. Jquery Mobile styles the label for the radio buttons so that they are larger and clickable. A custom set of icons to represent the radio button is added to provide additional visual feedback.     The radio buttons can be used singularly or in a vertical group or can be even grouped horizontally. These radio buttons can be used along with data-mini="true" too, which renders the radio buttons in a smaller size. We will take a look at all this in the example that follows.     In the first implementation you will see, 3 singular radio buttons which are not attached to each other like in the second implementation. T

Jquery Mobile Form - Flip toggle switch control

    A binary flip switch is a very common UI element in the mobile web world and was made popular by our very own iOS. This flip switch is used mostly for binary on/off or true/false data inputs. To create a flip switch or a toggle switch, start with a select with data-attribute="slider" and two options. Jquery Mobile would style this select as a regular flip switch with capsule corners and a a circular handle which can be either dragged from one end to the other or tap either sides of the switch.     The flip toggle switch is available in 2 flavors/sizes - regular and mini. Adding a data attribute data-mini="true" to the input tag renders a smaller sized flip switch. Let's take a look at the code sample below to understand the working in a better way.     In the code above, you will see 4 different implementations of the flip switch. The first one is a regular flip switch with the label and the toggle button one below the other. The second implementa

Jquery Mobile Form - Slider control

    Input field of type range is newly introduced in HTML5 and is very well styled. The style is further enhanced when using the Jquery Mobile framework and we will see how this can be done in today's post. Jquery Mobile styles the range input type with capsule-corners and adds a circular handle to the slider.   The input's value is used to configure the starting position of the handle and the value is populated in the text input. Specify the min and max attribute values to set the slider's range. If you want to constrain input to specific increments, add the step attribute.   As you drag the slider's handle, the framework will update the native input's value (and vice-versa) so they are always in sync; this ensures that the value is submitted with the form.     The range input elements are available in 2 flavors/sizes - regular and mini. Adding a data attribute data-mini="true" to the input tag renders a smaller sized input element. Let's take a