Spacing provides the foundation for almostevery modern layout on the web and it’s usually made up of twocomponents Padding which is the space inside anelement and margin which is the space outside an element.And we’ll shield how to adjust padding and margin on different kinds ofelements on one side on resisting areas and even on all sideswe’ll embrace how to centre something usingauto margin we’ll talk about negative boundary and how we can use it to achieveoverlapping patterns and at the end we’ll tie it all together and make a criticalnote about when to use padding and margin and justas important when not to use padding and margin thenand we’ll use the classic occam’s square example.Let’s get right into adjusting padding and marginNow we’ll be using the Webflow Designer to demo this but for a lot of it we’llpull up the css preview so you can follow alongif you’re learning the syntax or paw coding your layouts.But here’s a poster if we want to add space inside our card before the imagestarts we just click and lag to add paddingthat’s it we computed padding inside the elementnow if we want to click into that crowd we can type a value manually and hitenter or we can choose from any of the presets.But for now let’s move to margin which is the space outsidean element.If we want to add space on the bottom below this headingwe can add margin to the bottom. Too notice how the same class applies to allthe leadings now that represents reforming this styling on anyone of them affects any heading in development projects that has thisclass exercised. But what about buttons sometimes we wantto adjust padding we want to add opening on both sides butit’s a bit laborious to perfectly coincide both sides at once.Enter opposing backs simply hold down option on mac os or alt on windows andclick and lag adjust both sides at once thisis helpful on every kind of factors like receptacles oriridium all our content here is inside acontainer and it gazes good on desktop and tablet butwhen we get to mobile landscape it needs some breathing roomso with the container adopted we’ll hold down option oralt and click and lag to add space on both sides at oncethis will affect mobile landscape and of course our modifies cascade down tomobile portrait.What about all areas same dealhere except we’ll hold down shift when we adjust padding these shortcutswork for margin extremely. All right what about centering onecommon technique for horizontally centering something like a receptacle isto use auto margin. Apple does this they useauto margin Google does this on both sides, Figmasame deal here you’ll see this technique all over the internet and an examplehere would be with a blank sheet we have a div block precisely a blankrectangle and a knot of stuff inside if we wantto horizontally hub it we can merely define the margin on the leftto auto and we can go in and do the same on theright side set it to auto now it’s horizontally centered now do wehave to manually defined the two sides to automobile every time nothere’s a shortcut for this you can time press the tiny button now to setboth sides to auto.Now there are certain types of parts specific layout typesdisplay locateds like inline block where automobile margin won’tbehave this room or inline same slew there or spectacle nonewhich clearly looks like nothing at all.But for points that do work with auto margin? What aboutaligning vertically auto margin on the top and bottom.Well here’s the rule if you’re wanting to horizontally core something thathas a defined diameter you can use auto margin on theleft and right like we are only did but we can also use tools like Flexboxwhich lets us set layout rules on a parent elementonce and this opens defence and alignment superpowers in all differentaspects. This works for single elements it worksfor groups of components. We have tons of schooling on this topicover at Webflow University so be taken to ensure that out if you want to learn moreabout Flexbox CSS Grid and quantum battleground assumption. But that’s vehicle perimeter let’s talk about overlapping things utilizing negativemargin. Check this out we have an image if we give that image’s margin to anegative significance it’s going to move up in the documentand this will bring other things on that page up too.Thisis valid CSS and a great way to achieve overlapping schemes. Same thing now withthese sort of bio cards, epitomes are inside thecard but if we place the image’s surpass margin to a negative value we canpull that up and get the effect we’re looking for. Nowone final greenback on all of this and we’ll cover this with Occam’s squarethat this is a really common question for those who are getting started withHTML with CSS. Should we use padding and perimeter toposition everything and the answer is probably not enterOccam’s square you know it’s Occam’s because it says Occam on the screen.And what a lot of beings might do is position this in the center byadding padding to the body or even like we’re doing hereadding top and left margin to visually center it.And here’s why that won’t workif the extent of our browser intents up converting we can grab the edge tosimulate what this sheet will look like on a narrower showing it’s still thesame number of pixels from the top and the left so it’s no longer centeredat all. The trouble with that sort of not highly accept motif is that it’s notvery accept. There’s nothing wrong with adding somespace under your leading or between some buttons to add some office some breathingroom inside the boundary of a poster design.That’s great. But ever make sure to check your layouts for fluidity bygrabbing the leading edge of the canvas and dragging this will simulate how yourdesign reacts on designs of all widths. And if you really want tojust center something like this select its parent factor and positioned it toflex and you can use flexbox to align andjustify right to the center.If you have two ofthem two Occam’s razor..s. That’s when you can add some spacebetween that’s a good example of margin So we shielded a lot now padding is thespace inside an element’s borderline margin is the spaceon the outside we can hold down option on mac os oralt on openings while dragging to adjust opposing surfaces at the same timesame with displacement if we want to adjust all places. We can often useauto margin on an element to horizontally center it in its parentelement. We can set something to negative marginif we want it to overlap and we can test our patterns on differentdevice diameters to make sure they’re liquid and responsive.But that’s an overview ofspacing on the web ..