Go Back   Technology Forums > Computer Forums > HTML and CSS

Share your knowledge and questions, related to HTML and CSS in this forum.


CSS Wildcard / Universal Selector


Reply
 
LinkBack Thread Tools Search this Thread
  #1 (permalink)  
Old 02-15-2007, 10:40 PM
Administrator
 
Join Date: Dec 2006
Posts: 304
shri has disabled reputation
Default CSS Wildcard / Universal Selector

Here's a neat CSS trick, if you want to reset all the margins ( or any other applicable attribute for all elements ).

Code:
<style>
* {
    margin: 0px;
}
</style>
To keep things more obvious, we look at the following page.

Code:
<html>
<head>
<style>
* {
        border: 2px solid #000;
}
</style>
<body>
<table width="50%">
<tr><td>
<p>para with <b>bold</b></p>
<h1>H1</h1>
</td></tr>
</body>
</html>
This shows every single element of the HTML document with a 2px solid black border.

A more practical use for this would be to reset all the margins of a document to 0.

Code:
* {
   margin: 0px;
}
and then style the individual elements / tags to use user defined margins / padding ..
Reply With Quote
Reply





Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Advanced Search

All times are GMT -6. The time now is 07:33 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.