| HTML Tutorials |
|
|
| XML Tutorials |
|
|
| Browser Scripting |
|
|
| Server Scripting |
|
|
| .NET (dotnet) |
|
|
| Multimedia |
|
|
| Web Building |
|
|
| Java Tutorials |
|
|
| Programming Langauges |
|
|
| Soft Skills |
|
|
|
|
Except for one important difference,CSS margins are nearly identicle to the CSS
margin attribute :
a margin
defines the white space around an HTML element's border, while
margin refers to the white space within the border.
Setting the
actual value of margin is just the same as with margin, so you
can probably zip right through this lesson.
|
|
margin Parameters
|
|
margin-top
|
|
- To set the spacing at the top of an element,margin-top is used.
.
- You can have negative values (e.g. - 2px), however, please be careful using this one, because if you specify a high negative value (or rather really low) you can cause the visitors browser to crash.
|
|
CSS Code
|
|
|
|
margin-right
|
|
To set the spacing to the right of an element,margin-right is used.
You can have negative values (e.g. - 2px), however, please be careful using this one, because if you specify a high negative value (or rather really low) you can cause the visitors browser to crash.
|
|
CSS Code
|
|
|
|
margin-left
|
To set the spacing to the left of an element,margin-left is used.
You can have negative values (e.g. - 2px), however, please be careful using this one, because if you specify a high negative value (or rather really low) you can cause the visitors browser to crash.
|
|
CSS Code
|
|
|
|
margin
|
To set the general spacing that will be used on all sides of an element,margin is used.
You can have negative values (-2px), however, please be careful using this one, because if you specify a high negative value (or rather really low) you can cause the visitors browser to crash.
|
|
CSS Code
|
|
|
|
The following code set the left margin of a text
|
|
CSS Code
|
|
<html>
<head>
<style type="text/css">
p.leftmargin {margin-left: 2cm}
</style>
</head>
<body>
<p>This is a paragraph with no margin specified</p>
<p class="leftmargin">This is a paragraph with a specified left margin</p>
</body>
</html>
|
|
The follwing table describe the border Properties:
|
| Property |
Description |
values |
| margin |
A shorthand property for setting the margin properties in one declaration |
margin-top margin-right margin-bottom margin-left |
| margin-bottom |
Sets the bottom margin of an element |
auto length % |
| margin-left |
Sets the left margin of an element |
auto length % |
| margin-right |
Sets the right margin of an element |
auto length % |
| margin-top |
Sets the top margin of an element |
auto length % |
|
Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
Keywords:
css margin padding, left margin, bottom margin, margin-left
|
|
| HTML Quizes |
|
|
| XML Quizes |
|
|
| Browser Scripting Quizes |
|
|
| Server Scripting Quizes |
|
|
| .NET (dotnet) Quizes |
|
|
| Multimedia Quizes |
|
|
| Web Building Quizes |
|
|
| Java Quizes |
|
|
| Programming Langauges Quizes |
|
|
| Soft Skills Quizes |
|
|
|