Showing posts with label css. Show all posts
Showing posts with label css. Show all posts

July 7, 2015

Relational styling with CSS



As everyone knows CSS is used for styling webpages. There are actually a lot of ways to select and style a particular element of html element. You can also style multiple elements at a time. In this post I will show all the possible ways to style a particular elements.

html 

<section>
       <div>
              <p id="paragraph1" class="para">Hello I am first paragraph.</p>
       <div>
      
      <div>
              <p id="paragraph2" class="para">Hello I am second paragraph.</p>
       <div>
</section>

This is the html part to which we are going to apply the styles in a couple of seconds. I will show you styling the two paragraphs in multiple ways. Let's achieve it.

Using Direct elemental selections

p {
   font-size: 20px;
   color: blue;
}

We can directly select the particular element and style it as I show you in the above code snippet.

Using Classes

.para {
     font-size: 20px;
     color: blue;
}

In the above code snippet we have used it's class to achieve same result over selecting the p element directly.

Using ID's

#paragraph1 {
      font-size: 20px;
      color: blue;
}
#paragraph2 {
     font-size: 20px;
     color: blue;
}

Generally, if  you want to apply same styles for different elements Designers use classes rather than Id's. But, any how I just show one of the possible ways.

Using Relational Styling

We can also style the elements using their tree structures. In simple way parent child relations. Here if you observe the html structure once each div is the child of section and paragraph is the child of div and grand child of section. Using this relation we will style the paragraphs now.

section > div > p {
       font-size: 20px;
       color: blue;
}

We can also style this in the other way.

section p {
    font-size: 20px;
    color: blue;
}

So, these the different ways you can style the elements. Depending up on your comfortability you can choose any way you want or you can use all these ways for different elements.

CSS Positioning and floating elements


Positioning and Floating are the properties mainly used in css to layout the webpage. Let's see the different types of positioning available in css and discuss them with their usage.

There mainly four types of positioning

  • Static.
  • Absolute.
  • Relative.
  • Fixed.
Let's discuss one by one with their code snippet.

html

<div id="positioning">Helloo</div>

Static Positioning:
This is the default position of the element. If two elements are inline, then both of them stacked horizontally one after the other. In the same way if two elements are block then both the elements stacked one after the other vertically. Know more about Inline and Block elements.

Absolute Positioning

#positioning {
      position: absolute;
      top: 10px;
      left: 10px;
}
This way positioning take its position in the webpage with respect to (0,0) co-ordinates which mean from top left corner and it's position is fixed it doesn't adjust itself with respect to screen resolution. Actually it;s not flexible way of positioning the elements.

Relative Positioning

#positioning {
      position: relative;
      top: 10px;
      left: 10px;
}
The element take it's position with respect to its current position and more 10px from top and 10px from left. Many developers use relative positioning over absolute because it's more flexible way of doing things done.

Fixed Positioning

#positioning {
      position: fixed;
      top: 10px;
      left: 10px;
}
This element takes it's position with respect to the screen. When ever you give an element with fixed position then when you scroll down your webpage the element with fixed position also scrolls down along with the webpage. This type of positioning generally used for menu bars or nav bars to make to visible for the whole web page when user scrolls down.

Now, you have seen about positioning. I strongly recommend you to play around with these things as they are most confusing things in the CSS for the beginners. Now, let's move on for Floating the elements.

html

<div id="floating">This is a floating element</div>

css

#floating {
    float: left;
}
#floating {
    float: right;
}
#floating {
    float: inherit;
}
#floating {
    float: none;
}

You can learn more about floats here. You will find an awesome article about floating elements in the given link.

July 6, 2015

Block level and Inline elements in CSS


There are two types of elements mainly in the html, they are

  • Block level.
  • Inline
What are block level elements ?
Generally the elements which stack vertically downwards one after the other are called block level elements. 
Example : Div tags, P tags etc.
When you write a block level element the next elements will be stacked below the previous element. We can change the default behaviour of those elements using the css properties. Let's consider the below example.

html 

<div class="box">Box 1</div>
<div class="box">Box 2</div>
<div class="box">Box 3</div>
<div class="box">Box 4</div>
<div class="box">Box 5</div>

Now, when we see the result in our browser these boxes will stacked down one after other vertically. Let's apply CSS to it.

css

.box {
   display: inline-block;
}

After applying above property to the elements, those boxes now stacked horizontally.

What are Inline elements ?
The elements that are horizontally stacked and appear in the same line are called inline elements.
Example: Span tags, Img tags, anchor tags etc.
When you write an inline element if next element is also inline then both elements stack horizontally. But, if the next element is block level then it will be in the next line.

CSS hiding elements using Display property and Visibility property

In this post we will see how we can hide the elements using CSS properties. There are generally two properties we can use to hide the HTML elements.
  • Display
  • Visibility
These are the two properties available to hide elements using CSS. Many people think these two properties do the pretty much the same thing but, there is slight difference between those two properties. we will discuss them with code below.

html

<p>Lorum ipsum and some dummy text</p>
<div id="element1"></div>
<p>Lorum ipsum and some dummy text</p>
<div id="element2"></div>
<p>Lorum ipsum and some dummy text</p>

css

#element1 {
       width: 200px;
       height: 200px;
      visibility: none;
}
#element2 {
       width: 200px;
       height: 200px;
      display: none;
}

I recommend you to copy and past the above code and check the result and play around with it. Let me first explain you the difference between these two properties.

When you use display property and hide the element, it will pretty much hide the whole elements which means it will totally removes the element from the page and the elements below will get adjusted automatically.

But, when you use visibility property to hide the elements, it will just make the element invisible but the white space for that element will be still there.

June 2, 2015

Benefits of using font Icons over Images

Now a days the web developers are using font icons rather than images as icons in their web sites. There are a lot of advantages of using font icons. If you are still in a dilemma whether to use font icons or images, after reading this post I guarantee that you will be very clear about the usage of font icons.

What are those Benefits?

  • As they are just fonts, you can apply any CSS effect to them just like you do for fonts.
  • They are vector graphics so you can scale them up or down very flexibly.
  • You can apply colours and transformations just like you do for other HTML elements.
  • They are very fast to load and required only one HTTP request.
  • They are supported by any browser with any version number, which means they are cross browser compatible and mobile friendly.
There are some Cons also let me discuss them with you. Then you can decide to use them or not.

What are Cons?
  • You can style them with only single colour.
I think this is the only single disadvantage in using font icons.

What are it's Libraries?
These are most used font icon libraries. You can open links and find get started guide.

If any queries please comment below or mail us at ething4pc@gmail.com

May 7, 2015

Better combination of languages to write an awesome website


Every developer before starting to write some code to develop a website, need to think and consider some languages which fulfil their requirements. A developer needs to takes so many issues into consideration to start his/her application and accordingly need to choose languages. Some of such things include UI, UX, FUNCTIONALITY, SECURITY etc.

In this post I am writing about the languages to choose to fulfil almost all the above needs.


  1. HTML / HTML 5
This is the most common language which is used in every web based application. After advancement of HTML 5 Developers are able to develop awesome applications in mobile platform too . This language is commonly used for laying out your website.

    2. CSS / CSS 3 

This used to style the webpages written in HTML. Both HTML and CSS combines to create Front-End of the web site.

   3. JAVASCRIPT

After creating the basic look for your website now you want to give more awesomeness to your application by creating some animations and also create interactions between your website and a client. To accomplish this task u need JAVASCRIPT or it's Libraries like JQUERY, TWEEN.JS, CHART.JS, 

   4. BOOTSTRAP

Now a days, people are opening your applications from different screen sized devices. If your site doesn't support for different screen sizes then you are in big trouble of loosing more than 50% of your clients. Bootstrap is the best option to create responsive websites very easily with very less code .http://getbootstrap.com  is the official website.

  5. LARAVEL

The above language helps you to create world class User Interface and User Experience. Now comes the main part for any application i,e. Functionality. In present days no one wants any static website. Every one needs it with more and more functionalities and also in a secured way. Now to handle that LARAVEL is the awesome framework written on the basis of PHP. It helps you create most secured websites in some minutes. http://laravel.com is the official website.

So, this is it guys. Try mastering these languages and create awesome websites. Happy Coading

April 25, 2015

Creating overlay boxes using HTML, CSS and JQUERY


What are overlay boxes?
I think you may have come across this situation, when you open some website and click on login button one pop up box open with login or sign up form in it and there will be some semi transparent box surrounding that white colour box . Those pop up's are called overlay's.

What is the general use of these overlay's?
Suppose, if you don't want to show every information in the page by default when it loaded. and if you want to show certain kind of information after clicking particular link or a button and you want to show in the same page then you can use overlay's. If you want to run some kinds of special ads then also you can use overlay boxes.

Let's start creating an overlay box. here in this post I will show simple confirmation message pop up overlay, you can build up this according to your usage.

html

<div id="overlay"></div>

<div id="message_container">

        <div id="message_container_in></div>

</div>

<button id="btn">Click me</button>

css

#overlay{
      position:absolute;
      top: 0px;
      left: 0px;
      width: 100%;
      height: 700px;
     background: #000000;
     opacity: 0.7;
    z-index: 99;
    display: none;
}

#message_container {
     position: absolute;
     top: 200px
      width:100%;
     z-index: 999;
     display:none;
}

#message_container_in {
    width:400px;
   padding:10px;
    border-radius: 5px;
    margin:0px auto;
    font-size:20px;
   background: #ffffff;
   z-index: 1000;
}

JQuery

$('#btn').click(function(){

$('#overlay').show();
$('#message_container').slideDown(300);
        $('#message_container').text("You have clicked me");

});


This is it guys. I hope you understood the code written above. If you find any complexities please comment below so that I can explain everything.

April 24, 2015

Fixing the size of text area and removing resize icon using CSS


When ever you write <textarea></textarea> by default you see a text box with some width and height and also with resizing icon with which you can drag the width and height of that text area. In this tutorial I will show all the possible styling options for a Text area. Let's start.

html

<textarea id="myTextarea" placeholder="Write your message"></textarea>

css

#myTextarea {
          width: 200px;
          height: 100px;
          border: none;
          border-radius: 5px;
          resize: none; 
          padding: 6px;
}

Let us explain the css to you. I hope you can pretty much understand the css written above but, I will explain you the use of each attribute.

  • width sets the width of the text area. you can also use rows and cols attributes to set width and height.
  • height sets the height of text area.
  • border:none removes the default border around the text area.
  • border-radius: 5px give smooth rounded corners around the text area.
  • resize: none removes the default resizing icon present in bottom right corner of text area.
  • padding gives the padding to the text area.
You can also give background-color, font-size and color to the text area. 

April 19, 2015

Create awesome rounded corners in css border-radius property

Here I am showing a simple trick to create rounded corners for a particular box using css. You can give border-radius to each corner of a box independently. In this post I will show how we will do that.

html file

<div id="rounded_box"></div>

css file

#rounded_box {
       width: 200px;
       height: 200px;
       border-top-left-radius: 6px;
       border-top-right-radius: 6px;
       border-bottom-left-radius: 6px;
       border-bottom-right-radius: 6px;
}

In this way you use this border-radius property in most flexible way. Let me show the general equivalent styling for the above styling.

css file

#rounded_box {
       width: 200px;
       height: 200px;
       border-radius: 6px;
}

March 31, 2015

Where to, How to and What to start to become a web developer

Become a web developer

This is a general question I have come across in different question and answer forums. So many people are interested in learning so many different things but they don't know how to and where to and what to start with to get skilled and achieve their goals. As I am a web developer and I love creative stuff I want to suggest or guide those guys who are interested in getting skilled in web development. So here in this post I will give a few steps that will take you to the world of web development. So let's get started.

Step 1 : Get skilled in HTML/CSS . Here in this web site I am teaching 30 days to web development series you can also follow that. Otherwise in the right side bar I have give a few links under reference links column you can also follow those links.
Step 2: After finishing HTML and CSS go for CSS 3 and try to gain some knowledge on that too.

Above two steps can be finished hardly with in 2 weeks.

Step 3: After that try with JavaScript and gain a little knowledge.
Step 4: Now, you have got knowledge on HTML,CSS,CSS3 and JavaScript and you are ready for exploring with HTML 5.

You can finish Step 3 and Step 4 with in 2 weeks.

Step 5: Now, you have skilled pretty much above 60% in Web development. Now it's correct time for learning PHP and MySql which helps you to create server and client interactions.

You can finish basic functions of PHP and MySql hardly in a week or 2. Now at this point I will recommend you to create a full website and test your skills. While you are creating a real time web site I promise you that you can learn a lot more things and you get experienced in fixing bugs.

Finally, I want to recommend you to follow up this blog for more best tutorials, Tips and Tricks and also answers for general questions. you can also ask questions and get clarified in from the comments section below each post or by emailing us at ething4pc@gmail.com

March 28, 2015

How to restrict users to make a selection in the website

It's very simple to restrict the users to make a selection in the web page. Generally if you have some text rendering website in which you don't want to allow your users to select and copy the text from your web page then you use this simple code in your website.

body {
-webkit-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
-o-user-select:none;
user-select:none;
}

user-select is a CSS property used to restrict the user selection in the website. You can also restrict the users to select the particular parts of your web page also just by putting that same code lines in that part of styling. Again those different suffixes are for cross browser compatibility issues. -webkit- is for chrome, safari etc and -moz- for Mozilla  and -ms- for internet explorer and -o- is for Opera and simple one is for other remaining browsers.

If any query please comment below. I am very happy to answer your queries.

Create Buttons with different tags in html

In HTML you can create Awesome buttons with different tags. Here are some tips and styling tricks to make your buttons looks pretty.

buttons.html

<DOCTYPE html>
<html>
<head>
<title>Buttons</title>
<link rel="stylesheet" type="text/css" href="buttons.css">
</head>
<body>
<div id="container">
<a href="#" id="linkBtn">Link Button</a><br><br>
<div id="divBtn">Div Button</div><br>
<button id="buttonType">Button tag Button</button><br><br>
<input type="submit" value="Submit type button" id="submitType">
    </div>
</body>
</html>

buttons.css

/*Link Button Styling*/
#linkBtn {
text-decoration:none;
padding:6px;
background:#00bbaf;
font-family:calibri;
font-size:20px;
color:#ffffff;
}
/*Link Button Styling End*/

/*Div Button Styling*/
#divBtn {
width:200px;
text-align:center;
padding:6px;
background:orange;
font-family:calibri;
font-size:20px;
color:#ffffff;
}
#divBtn:hover {
cursor:pointer;
}
/*Div Button Styling End*/

/*Button Type Button Styling*/
#buttonType {
padding:6px;
background:red;
color:#ffffff;
font-family:calibri;
font-size:20px;
border:1px solid red;

}
#buttonType:hover{
cursor:pointer;
}
/*Button Type Button Styling End*/

/*Submit Type Button Styling End*/
#submitType {
padding:6px;
background:green;
color:#ffffff;
font-family:calibri;
font-size:20px;
border:1px solid green;
}
#submitType:hover{
cursor:pointer;
}
/*Submit Type Button Styling End*/

Buttons look like this 

Stay tuned for more tips and tricks.

March 27, 2015

How to Install Bootstrap?

Before knowing how to use the Bootstrap let me explain what is bootstrap, when and why we use it.

What is Bootstrap?

Bootstrap is a CSS and JavaScript library developed by two employees in the Twitter. It follows Mobile first approach to give the 100% responsiveness to the web applications in different screen resolutions. You just need to write code once and that it self adjust for different screen sizes. In 2014 Bootstrap is the Git Hub's top project according to Wikipedia.

Why and When we need to use Bootstrap?

Bootstrap is used for building responsive web applications with very less code. We just need to write code once and Bootstrap will take care about different screen sizes. 

Installing Bootstrap into your code

Step 1. Open http://www.getbootstrap,com which is the official website for the Bootstrap
Step 2. Click on the Getting Started link in the Navigation Bar.
Step 3. Click on Download Bootstrap button on the left side. You will get download files in Zip file format.
Step 4. Extract the files you will see three folders named css, fonts, js. 
Step 5. Open css folder and copy bootstrap.min.css file and bootstrap-theme.min.css file and paste in your working folder and include them in your files in the head section as a external style sheet.
Step 6. Open js folder and copy the bootstrap.min.js file and paste in your working directory and include this js file in your body section inside script tags. Other thing is you need to compulsory include jquery to use bootstrap js file functionalities. to do that.
Step 7. Open www.jquery.com and click on download button in the navigation bar.
Step 8. now scroll down a little bit you will find jquery latest series something like jquery 2x series. Now click on the latest file and download link with name production in it. extract the zip file and get the jquery-min.js and include in the working file before bootstrap js file.

Now your document look like this.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Tile of website</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
        <link rel="stylesheet" type="text/css" href="css/bootstrap-theme.min.css">
<script type="text/javascript" src="js/jquery-min.js"></script>

</head>
<body>


<script type="text/javascript" src="js/bootstrap.min.js"></script>
</body>
</html>

That's it now you are ready to write the responsive code. Stay tuned to this blog I will explain some of the important things we use in bootstrap very soon.


If you have any doubts please comment below or you can mail us at ething4pc@gmail.com.


March 22, 2015

CSS3 Media Queries

In the present days if you are a web developer, while developing, you need to concern about all the different screen sizes available in the market. There are hell lot of devices which are different screen resolutions creating a big headache for the developers. To accomplish this task generally what developers do is, using JavaScript and render different style sheets for different screen resolutions. But, still it's will become very big code and files become very large size. To avoid this there are Media Queries in CSS3. You just need to write them in your css file they will be written like this.

/*SmartPhone (Portrait and Landscape)*/
@media only screen and (min-device-width : 320px) and (max-device-width : 480px){

your styling goes here
}

/*SmartPhones (Landscape)*/

@media only screen and (min-width:321px){

your styling goes here
}

/*SmartPhones (Portrait)*/

@media only screen and (max-width:320px){

your styling goes here
}

/*Ipads (Portrait and Landscape)*/

@media only screen and (min-device-width:768px) and (max-device-width:1024px){

your styling goes here
}

/*Ipads Landscape*/

@media only screen and (min-device-width:768px) and (max-device-width:1024px) and (orientation:landscape) {

your styling goes here
}

/*Ipads Portrait*/

@media only screen and (min-device-width:768px) and (max-device-width:1024px) and (orientation:portrait) {

your styling goes here
}

/*Desktops and laptops*/

@media only screen and (min-width:1224px){

your styling goes here

}

/*Large screens*/

@media only screen and (min-width:1824px) {

your styling goes here
}

I recommend you to research about them and learn more. If you don't want to use this there is another option out there that is BOOTSTRAP. Bootstrap is the Css and JavaScript library created by two employees in Twitter. This is the best option to create responsive webpages. you check out their documentation at www.getbootstrap.com 

March 11, 2015

World of web development

This is the era where your skills and creativity are more important than your certificates. Your creativity and your output speaks louder than your degree certificates. So, the people who are running behind the degrees without learning any skills need to think now.

In this era gaining the skills we need is very easy what you need is interest to learn and that's it. There are lot of web sites which are offering free courses for different skills you need. What you need to do is just type in the Google search box and get the long list of website links.

If you are looking forward to learn web development and master it you are in the right place. We offer a series of tutorials that helps you to take you right from beginner level and place yourself in expert level.

What you want to do is to check our blog frequently and like our facebook page for daily technology and other updates.

That's it lets get started! Welcome to the world of WWW (World Wide Web).