• Home
  • Trace mobile number (From India)
  • Entertainment
  • SiteMap
  • Home
  • ASP.NET
  • C#
  • BLOGGING
  • SQL SERVER
  • FACEBOOK
  • Entertainment
Showing posts with label Tricks. Show all posts

Positioning in CSS

The CSS positioning properties allow you to position an element. It can also place an element behind another, and specify what should happen when an element's content is too big.The position property defines how an element will be positioned on a page - relative to it's position in the XHTML or relative to the top left corner of the browser window.

Elements can be positioned using the top, bottom, left, and right properties. However, these properties will not work unless the position property is set first. They also work differently depending on the positioning method.

position Syntax:

position: static | relative | absolute | fixed | inherit

Static Position-HTML elements are positioned static by default. A normal box, subject to the normal flow.Static positioned elements are not affected by the top, bottom, left, and right properties.

Fixed Position - An element with fixed position is positioned relative to the browser window.It will not move even if the window is scrolled.The box is placed in an absolute location relative to some reference point.

inherit Position-The element should have the same position value as the parent element.

relative Position-Box is in normal flow, offset relative to its normal position.A relative positioned element is positioned relative to its normal position.


absolute position-The box is placed in an absolute location relative to the container block.An absolute position element is positioned relative to the first parent element that has a position other than static. If no such element is found, the containing block is <html>:

position Browser Support:

Netscape 4, 6, 7
Mozilla 1
Firefox 1
Internet Explorer 4, 5, 6
Opera 3, 4, 5, 6, 7, 8
Safari 1

CSS (Cascading Style Sheet) is not very difficult to learn. The hardest thing is to ensure the CSS layout being displayed identically among different browsers.Following are some Very Helpful CSS Tips and Tricks that I think every web developer should be aware of. You may already know many of these tricks.Here is 10 Very Helpful CSS Stylesheet Tips & Tricks.

1. CSS Tips & Trick-Round Corners of DIV without using images

This is a simple CSS trick of rounding off the corners of the DIV using some css attributes.This will work on all CSS3-compatible browser. This technique will not work in Internet Explorer.

div {
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
}

To round a specific corner (top-left or bottom-right) use below stylesheet.

div {
-moz-border-radius-topleft: 10px;
-webkit-border-top-left-radius: 10px;
}

2. CSS Tips & Trick-Create an IE Specific Stylesheet

Create an ie specific stylesheet and include it in the webpage whenever the client is using Internet Explorer.The below code show you how to

include an IE Specific Stylesheet on webpage.

For IE use this


<!--[if IE]>
    <link href="ie.css" rel="stylesheet" type="text/css">
<![endif]-->

For IE7 use this 


<!--[if IE 7]>
    <link href="ie7.css" rel="stylesheet" type="text/css">
<![endif]-->


3-CSS Tips & Trick - Add Background Image of Textbox

you can use the following stylesheet to add background image to any input box.

input#yourtextbox {
background-image:url('backgroudimage.gif');
background-repeat:no-repeat;
padding-left:20px;
}

4- CSS Tips & Trick -Rotate Text using CSS

This example rotates text 90 degrees counterclockwise.

.rotate-style {
/* Safari */
-webkit-transform: rotate(-90deg);

/* Firefox */
-moz-transform: rotate(-90deg);

/* Internet Explorer */
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}


5- CSS Tips & Trick -Change Text Selection Color

By default, browsers uses blue color as the text selection. You can change this color to match your website theme.

/* Mozilla based browsers */
::-moz-selection {
background-color: #FFA;
color: #000;
}

/* Works in Safari */
::selection {
background-color: #FFA;
color: #000;
}

6- CSS Tips & Trick-Center elements

It's easy to center an element, for firefox and safari, we only need to specify the width and margin left and right set to auto. However, you will need to specify text-align to center in the parent element for IE.

body {
text-align:center; /* for ie */
}


#container {
width:800px;
margin:0 auto;
text-align:left;
}


7. CSS Tips & Trick - CSS Positioning

Set the abolute position within a container. #myitem will appear inside the #mycontainer exactly 200px from the left and 50px from the top.

#mycontainer {
position: relative;
width:500; height:300;
}



#myitem {
position: absolute;
left: 200px;
top: 50px;
}


8-CSS Tips & Trick -Prevent line break

This is a simple css tips, but some of us might not know about it. It forces the text display in one line.

h1
{
white-space:nowrap;
}

9-CSS Tips & Trick-Force page breaks when printing your document

h1{
page-break-before:always;
}
h2{
page-break-after:avoid;
}

h2{
page-break-inside:always;
}

10-CSS Tips & Trick - how to use group selector

Using group selector is a good practise to minimize your coding effort and also save a few bytes out of your stylesheet. We can group the selector to avoid repeating declaring the same properties for different elements.


h1, h2, h3, h4, h5, h6 {
font-family:arial;
margin:0.5em 0;
padding:0;
}
Following is the CSS Tips and Tricks that will Create a Fixed bar at bottom of webpage.Check this css tips.


<html>
<head>
    <style type="text/css">
        #BottomDiv
        {
            width: 100%;
            background-color: gray;
            border-top: 1px solid #fff;
            position: fixed;
        font-size:17px;
            font-family:verdana;   
            bottom: 0;
            left: 0;
            right: 0;
color:white;
            z-index:1000;
        }
    </style>
</head>
<body>
<div id="BottomDiv">
Hello, this is <a href="http://www.usetricks.com/">Usetricks.com</a> for more CSS Tips & Tricks Visit  <a href="http://www.usetricks.com/">Usetricks.com</a>
</div>
</body>
</html>






Hello, this is Usetricks.com for more CSS Tips & Tricks Visit Usetricks.com










Older Posts Home

Most Read

  • How to Capitalize the First Letter of All Words in a string in C# ?
  • keyboard shortcuts For Windows
  • List Of Best Free WordPress Plugins : 2012
  • Read Write XML Data-Read Write XML File Using C#, VB.NET In Asp.Net
  • How to Shake Internet Explorer - Javascript Code
  • How to Choose a Nice Topic for your Blog .
  • Free Search Engine Submission List ,search engine optimization
  • Number validation in Textbox of ASP.NET Using Regular Expression validator
  • Javascript:Percentage Gain Javascript Calculator
  • .Net Interview Questions and Answers on OOPS | OOPS Frequently Asked Questions
Google
Custom Search Bloggers - Meet Millions of Bloggers

Join Us On FaceBook

  • Recent Posts
  • Comments

All Topics

  • ▼  2014 (10)
    • ▼  January (10)
      • ASP.NET Interview Question : difference between ge...
      • Dot Net Framework:What is the .NET Framework?
      • Dot NET Framework - .NET Framework Interview Quest...
      • What is the differences between MVC2,MVC3 and MVC4...
      • Is try catch is using a good coding (exception han...
      • What is the use of Just - In - Time (JIT)?
      • What is GUID , why we use it?,how to create a GUID
      • How to Rename database table column in sqlserver
      • How to Rename Database in sqlserver
      • Asp.net Example Calendar Control
  • ►  2013 (14)
    • ►  October (1)
    • ►  April (2)
    • ►  March (11)
  • ►  2012 (142)
    • ►  December (25)
    • ►  October (1)
    • ►  September (9)
    • ►  August (2)
    • ►  July (7)
    • ►  June (2)
    • ►  April (5)
    • ►  March (27)
    • ►  February (27)
    • ►  January (37)
  • ►  2011 (23)
    • ►  December (3)
    • ►  November (6)
    • ►  October (12)
    • ►  September (2)
  • ►  2009 (1)
    • ►  June (1)

Tips & Tricks

  • What is good One Blog and Many Categories, or Many Blogs with One Categories?
  • Adding Twitter tweet button to each Blogger posts.
  • How to Choose a Nice Topic for your Blog .
  • Embedding YouTube Videos ,movie in your blog
  • Facebook iFrame Apps – Getting Rid of Scrollbars
  • Facebook Analytics:How to Set Up Your Website or Blog with Facebook Insights for Domains
  • How To Add Perfect Share Box to Blogger
  • Blogger Free Images Hosting Tip,Free unlimited bandwidth image hosting for Blogger blogs
  • Add “Link to this post” codes below Each blogger posts
  • Free Search Engine Submission List ,search engine optimization
  • Adsense Tips for Maximum CTR
  • List Of Best Free WordPress Plugins : 2012
2012 tectopix. All rights reserved.
Designed by tectopix