HTML/CSS Service

CSS Tips

Category: CSS, CSS3 Tutorial    |    748 views    |    Add a Comment  |   

 

  1. Use Reset.Css

    When it comes to rendering CSS styles, browsers like Firefox and Internet Explorer have different ways of handling them. reset.css resets all fundamental styles, so you starts with a real blank new stylesheets.

    Here are few commonly used reset.css frameworks - Yahoo Reset CSSEric Meyer’s CSS ResetTripoli

  2. Use Shorthand CSS

    Shorthand CSS gives you a shorter way of writing your CSS codes, and most important of all - it makes the code clearner and easier to understand.

    Instead of creating CSS like this

    1. .header {  
    2.       background-color#fff;  
    3.       background-imageurl(image.gif);  
    4.       background-repeatno-repeat;  
    5.       background-positiontop left;   
    6.     }  

    It can be short-handed into the following:

    1. .header {  
    2.       background#fff url(image.gif) no-repeat top left  
    3.     }  

    More - Introduction to CSS ShorthandUseful CSS shorthand properties

  3. Understanding Class And ID

    These two selectors often confuse beginners. In CSS, class is represented by a dot “.” while id is a hash ‘#”. In a nutshell id is used on style that is unique and don’t repeat itself, class on the other side, can be re-use.

    More - Class vs. ID | When to use Class, ID | Applying Class and ID together

  4. Power Of <Li>

    <li> a.k.a link list, is very useful when they are use correctly with <ol> or <ul>, particulary to style a navigation menu.

    More - Taming ListsAmazing LI

  5. Forget <Table>, Try <Div>

    One of the greatest advantage of CSS is the use of <div> to achieve total flexibility in terms of styling. <div> are unlike <table>, where contents are ‘locked’ within a <td>’s cell. It’s safe to say most <table> layouts are achievable with the use of <div> and proper styling, well maybe except massive tabular contents.

    More - Tables are deadTables Vs. CSSCSS vs tables

  6. CSS Debugging Tools

    It’s always good to get instant preview of the layout while tweaking the CSS, it helps understanding and debugging CSS styles better. Here are some free CSS debugging tools you can install on your browser: FireFox Web DeveloperDOM InspectorInternet Explorer Developer Toolbar, andFirebug.

    Read more…

    Share/Save/Bookmark

     

CSS Border images issues

Category: CSS, CSS3 Tutorial    |    1,301 views    |    Add a Comment  |   

 

First Issue: Several people have commented that they would like a way to clip out the center part of the image. There are two options for this: A) Keep the middle part by default (current behavior). Add an empty keyword that clips out the middle part. B) Make the middle part clip out by default. Add afill keyword that keeps it. (It’s needed for stretch-tiling things like aqua buttons.) Of course we might also just keep the current solution, C) have authors make that part of the image transparent. Comments? What would you use?

Second Issue: The syntax is particularly arcane. One commenter suggested breaking up border-image into multiple properties, leaving border-image itself as a shorthand. For example,

border-image: url(...) 20% 40% / 10% 4em 20% / 0 1em;

would be equivalent to

border-image-source: url(...);
border-image-slice: 20% 40%;
border-image-widths: 10% 4em 20%;
border-image-outset: 0 1em;

This would also allow the values to cascade independently, making it easy to e.g. swap just the image. There’s an overhead cost to more properties, however, so if we do this there needs to be a significant and useful advantage. Thoughts on this idea, or any other ideas for making border-image easier to understand? Read more…

Share/Save/Bookmark

  • No Related Post

 

Use CSS Specificity

Category: CSS, CSS3 Tutorial    |    280 views    |    Add a Comment  |   

 

If the selectors are the same then the latest one will always take precedence. For example, if you had:

p { color: red; }
p { color: blue; }

p elements would be coloured blue because that rule came last.

However, you won’t usually have identical selectors with conflicting declarations on purpose (because there’s not much point). Conflicts quite legitimately come up, however, when you have nested selectors. In the following example:

div p { color: red; }
p { color: blue; }

It might seem that p elements within a div element would be coloured blue, seeing as a rule to colour p elements blue comes last, but they would actually be coloured red due to the specificity of the first selector. Basically, the more specific a selector, the more preference it will be given when it comes to conflicting styles. Read more…

Share/Save/Bookmark

  • No Related Post

 

Advanced CSS Pseudo Elements

Category: CSS, CSS3 Tutorial    |    377 views    |    Add a Comment  |   

 

First letters and First lines

The first-letter pseudo element applies to the first letter of an element and first-line to the top line of an element. You could, for examples create drop caps and a bold first-line for paragraphs like this:

p:first-letter {
	font-size: 3em;
	float: left;
}

p:first-line {
	font-weight: bold;
}

Before and after

The before and after pseudo elements are used in conjunction with the content property to place content either side of an element without touching the HTML.

The value of the content property can be open-quoteclose-quoteno-open-quoteno-close-quote, any string enclosed in quotation marks or any image using url(imagename). Read more…

Share/Save/Bookmark

 

CSS Forms Designs Tips

Category: CSS, CSS3 Tutorial    |    497 views    |    Add a Comment  |   

 

Approach 1: Tables

Some would argue that form fields and their labels can be described as tabular data, and so can be slotted into a table that conveniently goes hand in hand with a grid-like presentational layout:

<table>
	<tr>
		<td><label></label></td>
		<td><input /></td>
	</tr>
	<tr>
		<td><label></label></td>
		<td><input /></td>
	</tr>
	<tr>
		<td><label></label></td>
		<td><textarea></textarea></td>
	</tr>
</table>

Some might say forms can be tabular data, some might say that this is a small pile of dingoes droppings - a cop out - hammering a cylindrical peg through a square hole. Not that I’m saying that, you understand… Read more…

Share/Save/Bookmark

 

How to use Superscript and Subscript

Category: CSS, CSS3 Tutorial    |    673 views    |    Add a Comment  |   

 

use the CSS property vertical-align with the value super or sub or even a length to achieve rudimentary superscript and subscript, but the problem is that in a paragraph, those lines with superscript or subscript text will alter the height of that line, resulting in an inconsistently spaced paragraph.

Step 1: The HTML

The way to get around this problem is to nudge the superscript and subscript out of the whole flow a little bit so if you have the following HTML:

<p>My name is Doctor Womac and I am going to teach you all about chemical formulae.
A chemical formula is a way to describe the chemical elements that make up a particular
chemical compound.It consists of chemical symbols to covey the elements and numbers to
show the number of atoms of
each element.H<span class="atoms">2</span>S0<span class="atoms">4</span> is the chemical
formula for sulphuric Read more...

Share/Save/Bookmark

  • No Related Post

 

What is Pull Quotes?

Category: CSS, CSS3 Tutorial    |    293 views    |    Add a Comment  |   

A technique traditional to print is the pull quote, a snippet of the content that stands out from its surroundings to grab a reader’s attention as they scan pages.

 

Step 1: The HTML

For the pull quote basics, we can start with some HTML like the following:

<p>If ever there was ...[Big load of text]... humble pea is it.</p>

<p>Mother Nature has never created ...[Big load of text]... something so flawless.</p>

<blockquote class="pquote">
	<p>It is not an exaggeration to say that peas can be described as nothing less than
 perfect spheres of joy.</p>
</blockquote>

<p>The green seed ...[Big load of text]... favorite for good reason.</p>

<!-- ...and so on... -->

The pull quote obviously being a quote makes the blockquote element the perfect choice. Read more…

Share/Save/Bookmark

 

How to Create a CSS Tabs

Category: CSS, CSS3 Tutorial    |    290 views    |    Add a Comment  |   

 

Tabs don’t have to be horizontal but they usually are so our first step is going to be to create a horizontal list, as already explained above.

We’re going to try a few different things here with CSS, but we’ll be sticking with the following basic HTML structure:

<div id="header"> 

<h1>Tabs</h1>
<ul>
	<li><a href="#">This</a></li>
	<li id="selected"><a href="#">That</a></li>
	<li><a href="#">The Other</a></li>
	<li><a href="#">Banana</a></li>
</ul>

</div>

<div id="content">
	<p>Ispum schmipsum.</p>
</div>

Basically, what we want to do with this HTML is turn each list item into a tab, with the selected item appearing to be part of the corresponding content area. Read more…

Share/Save/Bookmark

  • No Related Post

 

Introduction to CSS3

Category: CSS, CSS Tips, CSS3 Tutorial    |    687 views    |    Add a Comment  |   

 

What is it?

CSS3 offers a huge variety of new ways to create an impact with your designs, with quite a few important changes. This first tutorial will give you a very basic introduction to the new possibilities created by the standard.

Modules

The development of CSS3 is going to be split up into ‘modules’. The old specification was simply too large and complex to be updated as one, so it has been broken down into smaller pieces - with new ones also added. Some of these modules include:

  • The Box Model
  • Lists Module
  • Hyperlink Presentation
  • Speech Module
  • Backgrounds and Borders
  • Text Effects
  • Multi-Column Layout

Read more…

Share/Save/Bookmark

 

CSS Outline Properties

Category: CSS, CSS3 Tutorial    |    280 views    |    Add a Comment  |   

An outline is a line that is drawn around elements, outside the border edge, to make the element “stand out”.

The CSS outline properties sets the outlines around elements. You can specify the style, color, and width of the outline.

Note: Outlines do not take up space, and they do not have to be rectangular.

Browser support: IE: Internet Explorer, F: Firefox, N: Netscape.

Property Description Values IE F N No:
outline A shorthand property for setting all the outline properties in one declaration outline-color
outline-style
outline-width
- 1.5 - 2
outline-color Sets the color of the outline around an element color
invert
- 1.5 - 2
outline-style Sets the style of the outline around an element none
dotted
dashed
solid
double
groove
ridge
inset
outset
- 1.5 - 2
outline-width Sets the width of the outline around an element thin
medium
thick
length
- 1.5 - 2

Share/Save/Bookmark

  • No Related Post