Div file in css

Div file in css

How can i indent div with outer and inner margin?

View Answers

March 17, 2011 at 12:42 PM

You need to wrap it in another div. For example, make the outer div margin: 0 auto; and the inner div margin-left: 50px

That will indent its left margin by 50 pixels from the middle.

Indent div in css

<html>
<head>
    <title>Indent div in css</title>
    <style>
        #outer {
            margin: 0 auto; 
            width:200px;
            background-color:red; 
        }

        #inner {
            /*move the whole container 50px to the left side*/
            margin-left:-50px; 
            margin-right:50px;
            /*or move the whole container 50px to the right side*/
            /*
            margin-left:50px; 
            margin-right:-50px;
            */
        }
    </style>
</head>
<body>
<div id="outer">
    <div id="inner">
        This is the result!
    </div>
</div>
</body>
</html>









Related Tutorials/Questions & Answers:
div align left css
div align left css  Hi, How to align the div to left using the css in HTML page. Thanks
indent div css
/answers/viewqa/HTML/17553-indent-div-css.html :Indent DIV in CSS...indent div css  How can i indent with outer and inner margin?  
Advertisements
indent div css
Div file in css  How can i indent div with outer and inner margin... in css <html> <head> <title>Indent div in css</title>... it in another div. For example, make the outer div margin: 0 auto; and the inner div
How to add background image to div using CSS?
How to add background image to div using CSS
regarding css file in my eclipse
regarding css file in my eclipse  hai frns i want a small help frm u.when ever i use css file in html or normal web browsers the output is coming means css file is effecting the output but wen i use the same code in myeclipse
Getting Parameter from a css styled jsp file to a java servlet file...
Getting Parameter from a css styled jsp file to a java servlet file... .../css" media="screen" /> <!--[if IE 6]><link rel="stylesheet" href="style.ie6.css" type="text/css" media="screen" /><![endif]-->
passing values between jsp file through hyperlink in div tag
passing values between jsp file through hyperlink in div tag  <... type='text/css' rel='stylesheet' href='/css/crec.css' /&gt; &lt...; &lt;/tr&gt; &lt;/table&gt; &lt;br&gt; &lt;div
How to make a horizontally Scrollable grid in jsp using div, table, css, javascript?
How to make a horizontally Scrollable grid in jsp using div, table, css, javascript?  In a jsp page InsertUpdate.jsp (say) there is a button Insert to Save data in the database.I want that on clicking Insert button, besides
How to align div side by side?
Example of aligning DIV side by side in HTML page In this tutorial I will explain you how you can align the div side by side using CSS. The CSS... div and using CSS all these div's get aligned side by site. Here is the code
CSS
CSS  Make a navigation button using a div with a link inside it. Give it a border, background, and text color, and make them change when the user... style sheet validates at Note that some warnings may be unavoidable, but your CSS
DIV in HTML
DIV in HTML  What is DIV in HTML
passing parameter from Java code to CSS file - Design concepts & design patterns
passing parameter from Java code to CSS file  hi, i have to pass a string variable from by java code to a CSS file so that i can use that variable in my CSS file. Plz help me as soon as possible
jQuery To Hide the Div
on the div and having correponding style css. divClass .deleteDiv { position... jQuery To Hide the Div      ..._TO_REPLACE_1 Steps to develop the Hide of a Div . Step 1:  ADS_TO_REPLACE_2  
Showing div at the center of the webpage
Showing div at the center of the webpage  Showing div at the center of the webpage
Implementing CSS and JavaScript in JSP File
Implementing CSS and JavaScript in JSP File..., the following code imports style.css file from css folderADS_TO_REPLACE_1 <... Structure of css and script file cssScript.jsp ADS_TO_REPLACE_3 <
scrolling div ipad
scrolling div ipad   Please suggest me how to scroll the div in iPad UIWebView? Thanks
div background color in html
div background color in html   How to change the background color of DIV in HTML
class of div tag
class of div tag  How can i recognize the selected DIV class
div overflow hidden
div overflow hidden  How to make div overflow hidden? Thanks   Hi, Here is the code: <div style="widht:200px; height:600px; overflow:hidden;"> </div> Thanks
div style background
div style background  How to add background color to a div? What is the code of div style background?   Hi, You can use the following code: <div style="background-color: #ccffcc;"> <p>Content</p> <
jQuery Toggle the Div
jQuery Toggle the Div      ... of a DivADS_TO_REPLACE_1 Steps to develop the Toggle of a Div . Step 1:  ADS_TO_REPLACE_2     Create a new file (jqrycollapse.html) and add
div style float right
div style float right  How to align div to right? Share me the code for div style float right. Thanks   Hi, You can use following code: <div style="float: right; widht:300px; height:600px;"> <p>Content<
div to scrollbar - Java Beginners
vertical scrollbar. for this i am using a css for that div in which i tried to add...div to scrollbar  hi, thanks a lot for replying but my question is some what different let me make it more clear i have div which increases in size
image on div or cell of table
image on div or cell of table  I am using ms access database and I... but it display on browser but I want to display on inside the div tag or table tag pls... is to display on div or table... thnx in advance
image on div or cell of table
image on div or cell of table  I am using ms access database and I... but it display on browser but I want to display on inside the div tag or table tag pls... is to display on div or table... thnx in advance
image on div or cell of table
image on div or cell of table  I am using ms access database and I... but it display on browser but I want to display on inside the div tag or table tag pls... is to display on div or table... thnx in advance
image on div or cell of table
image on div or cell of table  I am using ms access database and I... but it display on browser but I want to display on inside the div tag or table tag pls... is to display on div or table... thnx in advance
image on div or cell of table
image on div or cell of table  I am using ms access database and I... but it display on browser but I want to display on inside the div tag or table tag pls... is to display on div or table... thnx in advance
image on div or cell of table
image on div or cell of table  I am using ms access database and I... but it display on browser but I want to display on inside the div tag or table tag pls... is to display on div or table... thnx in advance
remove and add div jquery
remove and add div jquery  I want to enable my users to remove or add DIV using JQuery.   $('.add_more').click(function(){ var description = $('#description').val(); $newEl = $('<div class="description_text
working of a div tag in html
working of a div tag in html   !DOCTYPE html PUBLIC "-//W3C//DTD...;body> <div style="width:100%; height:650px; background-color:#FF0000;"> <div style="background-color:#990066; width:100%; height:20
loading page in div
loading page in div  how to load another web page in div?   <div name="iframe" id="iframe"></div> <iframe id="foo" name="foo" src="http://www.w3schools.com/"></iframe> //and in Javascript
HTML div tag
HTML div tag  I have created a webpage using the div tag. The webpage has the header and the footer. the middle area is divided into left and right parts. The left side has a list of link. The right side part basically shows
HTML div tag
HTML div tag  I have created a webpage using the div tag. The webpage has the header and the footer. the middle area is divided into left and right parts. The left side has a list of link. The right side part basically shows
HTML div tag
HTML div tag  I have created a webpage using the div tag. The webpage has the header and the footer. the middle area is divided into left and right parts. The left side has a list of link. The right side part basically shows
HTML div tag
HTML div tag  I have created a webpage using the div tag. The webpage has the header and the footer. the middle area is divided into left and right parts. The left side has a list of link. The right side part basically shows
CSS ScrollBar Properties
CSS ScrollBar Properties  How can i set ScrollBar properties in CSS? I am using HTML, CSS and Div in my code. Thanks!!   overflow: scroll; overflow-y: scroll; overflow-x: scroll; overflow:-moz-scrollbars-vertical
Resize outer div when inner div's height increases
Resize outer div when inner div's height increases   How can I increase the outer div height automatically when inner div's height increases in javascript
DIV ERROR - Framework
DIV ERROR  I HAV FACING THE PROBLEM..... when...i m fetching... ....at that time the view is very good....but if there hav'nt any space at that time my div... stretched ..but the data crossed my div tag..... any body can give me
Drag from DIV overflow - Ajax
Drag from DIV overflow  Hello All, I have Two html DIVs to use. What i want to do is click and drag item from First DIV and drop in Second DIV... from First Div, this item which i drag did not go beyound from Frist Div. How
JavaScript Hide Div
JavaScript Hide Div...; In this section, we are going to hide div element on clicking the button using the JavaScript. In the given example, we have created a div element using <div>
CSS in flex
dynamically loading of CSS file is not supported in flex. you can compile the CSS file in swf and use it dynamically in your application. Loading style sheets at run time is a three-step process: 1. Write a CSS file for your application
JavaScript move div
JavaScript move div...; This section illustrates you how to move a div element on the window using JavaScript. In the following code, we have defined a div element consisting of text
ModuleNotFoundError: No module named 'div_lists'
ModuleNotFoundError: No module named 'div_lists'  Hi, My Python... 'div_lists' How to remove the ModuleNotFoundError: No module named 'div... have to install padas library. You can install div_lists python with following
ModuleNotFoundError: No module named 'div_lists'
ModuleNotFoundError: No module named 'div_lists'  Hi, My Python... 'div_lists' How to remove the ModuleNotFoundError: No module named 'div... have to install padas library. You can install div_lists python with following
ModuleNotFoundError: No module named 'div_lists'
ModuleNotFoundError: No module named 'div_lists'  Hi, My Python... 'div_lists' How to remove the ModuleNotFoundError: No module named 'div... have to install padas library. You can install div_lists python with following
ModuleNotFoundError: No module named 'div_lists'
ModuleNotFoundError: No module named 'div_lists'  Hi, My Python... 'div_lists' How to remove the ModuleNotFoundError: No module named 'div... have to install padas library. You can install div_lists python with following
ModuleNotFoundError: No module named 'div_lists'
ModuleNotFoundError: No module named 'div_lists'  Hi, My Python... 'div_lists' How to remove the ModuleNotFoundError: No module named 'div... have to install padas library. You can install div_lists python with following
JavaScript getElementById div
JavaScript getElementById div... example we have used document.getElementById() method to get access to a div element... of getElementById() method on a div element. We have created a div with the id "
Tomahawk div tag
Tomahawk div tag          This tag is used to places an html div around its children. So instead of using html div tag we can use JSF tomahawk's own div

Ads