The CSS margin properties define the space around elements.


The property which determines the size of an object on the X-axis

Greater div bigger

Quality Example

"A common solution is to float your fixed-width column left or right and give the other column a margin equal or greater than the width of the fixed-width column"

from question "Html width (100% -n px)?"

"I just made the left margin of div2 greater than the width of div1 and it worked for me"

from question "Div2 inside another Div1. How to make these Div1 and Div2 to be appeared side by side"

"Give the sample text div a right margin greater than the width of the right-floated element"

from question "How to use CSS float without hiding parts of a DIV"

"The title goes in a h1 for example and the text in a p or div so set these two elements to have a left margin greater than the width of image a"

from question "How to achieve this layout with CSS?"

"On release the drawer should slide open if its margin is greater than half its width and should close if its less"

from question "* (no title is found for this review)"

"You have given width of 50 with additional margin of 5 to each of the element which is greater than 100 width"

from question "Div's not aligning next to each other"

"Once the negative margin is equal or greater than the width of that element further negative margin has no effect"

from question "Jquery move the rows to the left"

"You can try giving an id to each one of the divs or style them for margin that is greater than or equal to the image width.assuming you image width is 50px this code shall work"

from question "How to retrieve all images from sql to the html DIV tag using php?"


"Now if the div with has margin 660px from the left it should be hidden because it s margin is higher than the maximum width of the main container"

from question "The div with id 'intro' should be hidden but it shows. What has gone wrong?"

More div

"How to place 2 div side by side one div is of 75 width and the other is 25 more div with margin 0 auto"

from question "Fluid and Fixed Layout both"


"Another option is not to float the main content column but instead assuming it s the right column to give it a large left margin that is slightly wider than the width of the left column"

from question "How do I stop my 2-column layout from pushing the right floating div below?"


"You re negative margin is more than half the viewport width of an iphone therefore it is dragging it out of view"

from question "CSS responsive-design issue between pc browser and iphone browser"

"Adding margin adds more width making the total width of the two elements and their margin greater than 100 pushing the elements onto separate lines"

from question "How to add margin in bootstrap?"

Auto better

"First one margin auto is better if you can know width of container list and you don t want centre content of this container"

from question "How do I center my list?"


"The the main content div needs to have left margin larger than the width of your sidebar"

from question "Sidebar which can scroll but with the main content fixed"

"When the screen width becomes larger than 500px the contents of the media query are ignored and the margin becomes 20"

from question "Is it possible to set the minimum value of a margin set by a percentage using CSS?"

"By giving the middle indicators div a left and right margin slightly larger than the width of the left and right button divs you allow it to float up between the two and take up as much space as possible"

from question "3 Div's in a container with a Dynamic Width Centered Div"


"One way of doing this is checking if left margin of the inner div is lesser than the width of sidebar and then only add class adjust"

from question "Add margin to page content when absolute element is visible but keep centered"


"If the content leads to a width that is less than 100 of the table s containing block then setting the left right margin to auto will center the table within the containing block"

from question "Why the table tag without width can be centered"

"The elements are sized relative to the entire viewport but the body width is less than this because of the default margin on body"

from question "Bizarre interaction with floats and Viewport Percentage units"

"You have to take into consideration that borders take up width and that the margin of 1 of either side of the large container means that it can only be less than 100 width"

from question "CSS Layouts and inline-block with width %"

"But if the screen width is less than 200 then it will be from left view edge margin to right view edge margin."

from question "Positioning text in UIView"


"Aside of the left floated div i have another div article with a margin a little bigger than the width of the floating div just usual for a two column layout"

from question "A floating div and a div below an absolute positioned div leads to extra margin - why?"

"Anyway i just set the margin to a value a little bigger than the width of the image and overlap is eliminated only in the very specific case we want"

from question "Fluid, Max-Width element (subtitle), respective of left float, if present. Possible? Currently it ignores margins and padding"

"The reason why your website is x-scrollable on all devices is that you forgot to add to and the row inside it has 100 +15px left margin +15px right margin which is bigger than window width"

from question "Bootstrap page Overflow-x hidden, one element on page on IOS still scrolls left and right"

"What i do not understand is why the size of the point and the text is not the same and why the margin can be bigger than the width of the figure"

from question "R units of margins, text and points in a figure"

"But in general this wouldn t work because of the specified width is bigger than the real one and exceed it so there s no margin to auto it and center the content which found in div"

from question "Content not centered in properly way"

"When i launch it with firefox or internet explorer the box gets immediately to a huge distance from the margin much bigger than the width of the screen and now i noticed that if i run it with stackoverflow s snippet function the box does not move"

from question "Make a div move using jquery"

"The box is never too small infact the margin of the adjacent div is bigger than the width of ul div"

from question "Float mistake in arbitrary-width div positioned absolutely"

Quality Example

"And if they aren t next to eachother that means your padding and margin is more than the 5 width of total width so reduce them"

from question "Child div positioning css"


"This means they won t float next to one another unless you set the width of each so that the combined width + margin + border + padding of both blocks is equal to or less than the width of the container"

from question "How does browser combine two block elements?"

"Just so you know you want the total width object width + padding + margin + border of both columns to be less than the width of the container"

from question "How do I float this div column to the right?"

Css height directives

Quality Example

"I notice that when the arrow block is rendered when width is less than 296 px inside the carousal there is some space between the left border of the carousal and the arrow block even though i did not add padding or margin"

from question "CSS Width Issue for inline block elements"


"Edit someone else suggested css and i believe that using the height and width directives from css will give you the same result as using the same attributes of the tag but doesn t limit you strictly to images and a will play nicer with any margin or padding directives you might use"

from question "Web page appears scattered when loading?"


Quality Example

"I m using the function window .resize to detect if the total width of all open windows plus some margin is greater than the window s width then hide the first chat window or show the last one if there s space for more windows"

from question "How to hide Facebook chat boxes on Window resize?"

Animation longer

"My guess is that they are technically happening simultaneously but that the margin animation takes longer to complete than the width animation"

from question "Slide Over Menu combined with Bootstrap"


"But the margin is more difficult to include in the width because it is on the outside of the box"

from question "Padding change the layout two div side by side"

"50 width is more than enough for the images to fit even with the image margin"

from question "Table overflows width of parent only in Firefox. Not caused by padding/margin/border"

"If browser width is more than 768px then set a 110px margin"

from question "Dynamic height() with window resize() with variable margin"

Size greater content

"The first-child column has 10 pixels or whatever the margin size is greater content area width than it s siblings"

from question "CSS fluid columns, fixed margins; the holy grail of holy grails"


"Essentially my logic is when the window is re-sized and the width is less than 810px then remove all css styling and add margin top items 2 through infinity"

from question "On the Fly JQuery Resize"

"Instead of the reaching 100 width the margin is causing less width for them due to the 20px x 12"

from question "Responsive columns not working?"

Clipping earlier

"So it would also be possible to have all three textblock columns starsized but that means width clipping does occur earlier and there is more margin"

from question "How to automatically scale font size for a group of controls?"

S more related

"Margin using percent doesn t work cross browsers on flex items so if your margin s is more related to the viewport use viewport units vh or vw else you can combine px with css calc width calc 33.333 - 20px to match an equal gutter between the items"

from question "Collapsing margin on Flexbox grid in Edge and Firefox"

Back to Home
Data comes from Stack Exchange with CC-BY-SA-3.0