Margin

The CSS margin properties define the space around elements.

Width

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



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

"The padding and margin are added to that width which makes everything wider than you would think"

from question  

My Left Column in CSS doesn't fit in the div I created

Content border padding

Example

"With this style the whole element will only be the width of the width style and the content area gets smaller as margin border padding are applied"

from question  

How to make a 4X4 div panel inside another div?

"To make sure the margins shrink before the content use a fixed pixel width for the content and margin 0 auto;and when the pixel width is wider than the screen make that width smaller"

from question  

Collapsible Margins HTML/CSS

"You need a div as a wrapper for your webpage and set a fixed width or max-width if you want the content to be able to become smaller on smaller screens with margin set as auto for margin-left and margin-right to keep the page centered"

from question  

How do I make it so my website zooms in and out without effecting the layout of the website from the center?

"This creates the box model i just described where the content width is equal to the width style and the element gets bigger as margin border padding is added on"

from question  

How to make a 4X4 div panel inside another div?

"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?

"The width padding and margin together make the box model so that the total width of the element is larger than the width of the screen"

from question  

Div is not centered properly, why?

"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

Images space image

Example

"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

"I tried calculating the images width and the margin space between them to set the limit value for the right button so slider doesn t slide past it but that doesn t work if you see it on another device because it s width is higher"

from question  

Carousel right click button not working properly

"For example let s say width of one image you want is 200px then also you d like to have some space as margin between images too so let s say if browser width is more than 700px then we ll have images on the same row else we ll have them one below the other"

from question  

All images in one single row, or all images below each other

Behavior negative example

Example

"With both boxes floated right the second box is placed on the left of first box +------------------------------------------------+ | +-----++-------+| | | red || black || | +-----++-------+| | | with widths added on the boxes the second box is pushed on a new line +------------------------------------------------+ |+----------------------------------------------+| || black || |+----------------------------------------------+| | +----------------------+| | | red || | +----------------------+| | | with negative left margin width added on second box the second box is placed next to first box +------------------------------------------------+ +----------------------++----------------------------------------------+| | red || black || +----------------------++----------------------------------------------+| | | | | | | | | a rough explanation of this behavior is that when you add a negative margin equal to greater than the width of the element it apparent width becomes 0 and browser will fit it on the same line"

from question  

Why float element works weird with negative margin?

"Here is a basic example as you can see the trick is to define the margin considering the width of the container 100 and we will have two cases when the width is bigger than xpx we have a positive margin and a normal behavior with spacing when the width is smaller than xpx we will have a negative margin and will have the overlap effect without wrapping"

from question  

Overflow clipped, rest of the content visible

Value base widget

Example

"So to calculate the width including the outline you need to explicitly add it;note even if you decide to take the elements width including margin you wouldn t get the outline-width value by just using outerwidth true"

from question  

Does jQuery outerWidth() includes css outline?

"So i called a mediaquery to get the screen size and base the widget off that margin just slightly less than the width of whichever screen it is on to make the value responsive"

from question  

Responsive element alignment with MediaQuery - called with a context that does not contain it

Viewport body iphone

Example

"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

"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

Screen margin size

Example

"For width 100 in some screen margin 10px is more then 1 so"

from question  

Responsive css two columns cancel float left

"If the width is less than the screen size;margin auto"

from question  

Images/Buttons will not center

Padding css directives

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?

Right div greater

Example

"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?

"Tables are one such instance that don t seem to align without margin auto;also make sure your div width is larger than your button width"

from question  

How do I horizontally center align a button?

"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

"You can try giving an id to each one of the divs or style each one of the divs 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?

"You said you specified the height to 800px and wanted the div not to stretch when the width was greater than that.;to center horizontally you can use the margin auto"

from question  

How to align a <div> to the middle (horizontally/width) of the page

"The second div input-btn-col is covering the div with the select element select-col because it has 100 width and is floating left and it nested div has a margin on the left"

from question  

Cannot open select in 3 column fixed-fluid width layout

"The whole problem is because of the div 2 height and width is larger than div 1;as we know padding width and height is not added to the element width and height as it is done for margin"

from question  

Chrome won't render right padding when the overflow style is set to "auto"

"What you are doing is saying the element should be as wide as the browser window 100 of the window width and then also saying that outside that width the element should have more margin in your case 15px on the right and 260px on the left and that is streching the page causing the total widht to be larger than window width"

from question  

JSFiddle - Website blank hidden space

"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

"Give the heading a right margin equal to or greater than the width of the floated element"

from question  

Text goes over a floated div which have negative margin

"You can do it by adding one more div with 980px width to wrap inner container so applied margin will work"

from question  

How to add margin to fixed inner container within fixed outer container?

"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

"Ositioning the element 20px from left and right and setting width to auto will make it get the right width while respecting the gap you want it to have on either side;and margin auto 0 would work as well simply undoes the margin you used earlier to center the element"

from question  

CSS - responsivly center div, position fixed

"To ensure that the element s maximum width is less than the width of the parent allowing some space between the content of the element and the borders of the parent;margin 0 auto"

from question  

Stop div resizing parent div using css

"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

"Margin 0 auto brings any block element to center if margin 0 auto has some width applied which is less than margin 0 auto parent element s width"

from question  

Menu at centre on adding width to nav ul otherwise at corner

"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?

"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

"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)?

"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 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

"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

"The width of the span content plus the left margin is greater than 1000px and so 1000px wraps spans to the next line"

from question  

Ie 8 browser issure div comes next line

"Therefore assuming the container s width is greater than the image s height margin -50 0 should be enough"

from question  

Putting emoticons in paragraphs without affecting `line-height`

"As we know padding width and height is not added to the element width and height as it is done for margin;so the scroll get the scroll width and height of the div 2 and as the div 2 height and width is greater than div 1 padding to right and bottom is not visible"

from question  

Chrome won't render right padding when the overflow style is set to "auto"

"Ox-sizing border-box sets the height width of an element and takes into consideration the padding as well as the border width;the scope of an element s margin is greater than the element itself meaning the element itself modifies the flow of the page and the element itself surrounding elements therefore directly altering the way the element fits within the element itself parent relative to the element itself sibling elements"

from question  

CSS3 box-sizing: margin-box; Why not?

Auto flex item

Example

"Use min-width and or max-width to give that element a defined width which is more flexible than a single width value and then give that element a margin 1em auto style to centre it horizontally within the unused width available in it parent element"

from question  

How can I center this DIV (CSS/HTML)

"You container is set with display flex and .hero-image is a flex item and it s width is no more 100 like a default div but it s equal to size of its content and that s why margin auto is centering your element where you don t need to specify a fixed width"

from question  

Why is margin: 0 auto centering text on image without width specified?

16px 20px x

Example

"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?

"Because width 100 plus margin 16px is more than 100"

from question  

Div margin always off the right side of the page

Large h3 classes

Example

"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 %

"While width is less than 780px h3 will have this classes;2 - you will have problems with the margin in the container i would add padding to the container instead of using margin in the boxes inside"

from question  

How to create responsive boxes with even margins inside a centered parent div

Others

Example

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

from question  

Dynamic height() with window resize() with variable margin

Of course you need first to check there is enough place before to write a word supposing the separator are only spaces all the separators are produced even consecutively or at the beginning of a line in case a word is longer than the width a word is not cut case of azeryuiop in the execution later a proposal from your code where the program receives in argument the left margin the width and the string compilation and execution

from question  

Need to word-wrap text in C

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?

You must set the leading and trailing numbers to zero never negative even though the width is bigger;interestingly you can actually set the leading trailing numbers to any positive value try say 50 and it gives you kind of a margin of the bounce

from question  

How can I use Autolayout to set constraints on my UIScrollview?

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?

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

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?

I noticed your website width might is bigger than the browser;instead of using margin -8px on you .container and .footer just set

from question  

Some html+css code make all page shift

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

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

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

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

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

When max-width is smaller than width of .divs is effectively smaller than thus margin 0 auto works

from question  

My max-width:1140px is not working it cannot be in center my margin:0 auto

This creates columns of equal width and your buttons reside within each columns;you can add spacing between your buttons by providing a margin read more here

from question  

CSS Bootstrap setting button width for landscape and portrait

Since the smaller child view is 50dp you have added a margin of 130dp the total width it needs is 180dp but the parent view itself is only 150dp wide;that is - the child plus the margin cannot fit inside the parent

from question  

RelativeLayout align parent *side* + margin *side*

Using a left margin of auto and a right margin of 0 the div will be flushed to the right;note that i also used a padding of .5ch for one half of a letter width which is better than 3px hardcoded

from question  

Problems with the div tag in CSS and inline borders that go around the div

Also note that when a margin is specified in terms of percentage the margin s value is computed as a percentage of the width of the container;even for the vertical margins the percentage is applied on the width and not the height of the container

from question  

How to position a div with equal margins for left, right, and top

Width + translate is maybe not the best way;block and margin auto is less tricky

from question  

Image aspect ratio inside absolutely positioned div

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?

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

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

Using autoscale sales the pdf document smaller than the width of the screen it basically adds a margin around the pdf

from question  

IOS PDFKit not filling UIView

T s rendered with a gap usually called margin or padding between the bullet and the content;so because the is inside the the width is already smaller than the width of

from question  

How to reduce the length of the border bottom line in css

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  

* (no title is found for this review)

Simply put when you want an image to go to 100 of the monitor then you need to put it into a container with width as 100 and margin auto not fixed width and no position at all;you will see if you increase the width of the fiddle box then the image automatically increases width without having any scroll bar

from question  

Why is horizontal scroll bar going far beyond content?

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

On a 5 screen roughly the width is 400px more or less and the height is 600px or more;so a left margin of 909 will push it off the screen area for good let alone the top margin

from question  

UWP App layout gets screwed up when elements are dragged

For a horizontally centered image - display flex and justify-content center on the parent element of the image that has a specified width;however for your example i used margin auto because margin auto is actually simpler

from question  

CSS - center and rounded Img Inside Div

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?

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)

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

With the top chart labels set at a precision of 8 and the bottom chart having a max of 5 digits 10 000 as the max the width of the bottom chart can be made equal to the width of the top chart by including the following however if the number of digits in the bottom chart s valueaxis labels changes then the left margin is no longer correct

from question  

AmCharts 4 - How To Make Chart Widths Equal With Different Length ValueAxis Labels

I believe it was only one single page whose width is more than the screen s width;and the default view is achieved by setting the margin or other property which is for you to findout using trial and error

from question  

How to host multi-pages in phoneapplicationframe in wp8 like facebook 5 for wp8 app

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

from question  

Fluid and Fixed Layout both

As you use the margin of 1.66 that s why you must have to use less than 30 width in div.main-column

from question  

* (no title is found for this review)

It is this line the takeaway is that something with a width of 100 and a margin will end up being more than 100 width of the page

from question  

Unwanted white space on mobile version

Also make sure to include jquery this is possible paste this beneath all other scripts to your .userhasscrolled class you can set something like this --first answer-- what you ask for is media screen and max-width 767px while the screen width has a lower size than 767px you can define an overwriting css style like this but this causes another problem while the navbar is closed the main class will still have a margin of -336px and that s not what you want i guess

from question  

Issue with CSS minus margin

T also trims the width by a percentage referred to as the margin;the margin is only used if the margin is greater than zero and you would specify a number like 0.20 twenty percent

from question  

JFreeChart - How to remove gaps between XYBarRenderer in a TimeSeriesChart

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