Brief us your requirements below, and let's connect
1101 - 11th Floor
JMD Megapolis, Sector-48
Gurgaon, Delhi NCR - India
1st floor, Urmi Corporate Park
Solaris (D) Opp. L&T Gate No.6
Powai, Mumbai- 400072
#12, 100 Feet Road
Banaswadi,
Bangalore 5600432
UL CyberPark (SEZ)
Nellikode (PO)
Kerala, India - 673 016.
Westhill, Kozhikode
Kerala - 673005
India
Cascading Style Sheets (CSS) is the style sheet used to define the HTML elements. This can be also applied to any kind of XML document, including plain XML, SVG and XUL. These styles are normally saved in external .css files. These external style sheets can save lot of your time while editing the layouts of all the pages in a website.
Here are some important and useful CSS tips and tricks that can be helpful for developers.
Table of Contents
Most beginners miss the !important CSS rule, This CSS rule is applied to increase its rank over other subsequent rules. For the example below, the blue color is made more important than the red color:
.page { background-color:blue !important;   background-color:red;}2. Centering a Fixed-Sized Element
This is one method to center a fixed-height/fixed-width div at the center of its container. This can be also used for centering text, images etc. Please note that parent container must have a position: relative property for this work
<pre>div { position: absolute; top: 50%; left: 50%; width: 400px; height: 300px; margin-top: -150px; <strong>/* 1/2 of your element height*/</strong> margin-left: -200px; <strong>/* 1/2 of your element width */</strong> }</pre>3. Removing Active Link Borders
You might have noticed, browsers like Internet Explorer and Firefox adds a dotted line border over the link user clicked before. It is useful user accessibility feature but if you want to get rid of it, here is the small code that can help you.
a:active, a:focus{ outline:none; }4. Small Caps Text
Small caps text property can make all the letters to capital. This also makes all other letters other than the first, to be a little smaller.
font-variant:small-caps;5. CSS transform for Hover Effects
Mouse hover effect is always a better choice for better user experience. This CSS transform trick enables you to create interesting hover effects. You can also enhance this feature by using transform property. This is supported by many browsers which have CSS3 support.
a { -moz-transform: scale(1.1); -webkit-transform: scale(1.1); -o-transform: scale(1.1); }6. Removing Image Border
What is your opinion about image hyperlinks? Most of the times they look ugly right ? For the people who wants to remove border on hyperlinked images, here is the CSS code
a img{ border:none; }7. Creating Forms Using Labels w/o Tables
You don’t need tables to layout forms, those were old days. Now CSS is capable to make forms using label tags. Label tags makes your forms more accessible.
</pre> <form method="post" action="#" > <p><label for="username" >Username</label> <input type="text" id="username" name="username" /> </p> <p><label for="password" >Username</label> <input type="password" id="password" name="pass" /> </p> <p><input type="submit" value="Submit" /></p> </form> <pre>You may also like some of our html best practice tips. Read it at html best practices.
Looking for a good team
for your next project?Contact us and we'll give you a preliminary free consultation
Contact Us Now!
on the web & mobile strategy that'd suit your needs best.
Designing for Zero-Latency Websites: The Next Challenge in Web Performance
Posted on Dec 18, 2024 | Web DesignCognitive Load Theory in Web Design: Reducing User Overwhelm for Optimal UX
Posted on Dec 12, 2024 | Web DesignTop Web Design Trends for 2024
Posted on Nov 07, 2024 | Web Design
Hi,
Great Post! CSS is the well-known and key element that is used to develop unique, attractive & user-friendly websites. Thanks for sharing these useful tips.
This is very useful tips for every UI-Developer and Designer .
Thanks For sharing Valuable Information .