Register now and be part of our community! When you register with the Net Hosting Talk you can join in with topics, start new topics, and generally be a part of the first level of our community. It's also quick and totally free, so what are you waiting for?
I'm learning CSS and I doubted the differences, well I'm designing a page with css but use margin-top and then change it to top and there was no change, then I do not know when to use u when using the other.
no, it is usually better to maintain margin than positioning, positioning can disagree on responsive, margin is more solid in that aspect, usually top and left is used with position when it is absolute or fixed.
You'd use margin, if you wanted to move a (block) element away from other elements in the document flow. That means it'd push the following elements away / further down. Be aware that vertical margins of adjacent elements collapse.
If you wanted the element to have no effect on the surrounding elements, you'd use positioning (abs., rel.) and the top, bottom, left and right settings.
With relative positioning, the element will still occupy its original space as when positioned statically. That's why nothing happens, if you just switch from static to relative position. From there, you may then shove it across the surrounding elements.
With absolute positioning, you completely remove the element from the (static) document flow, so it will free up the space it occupied. You may then position it freely - but relative to the next best non-statically positioned element wrapped around it. If there is none, it'll be anchored to the whole page.
My undеrstаnding is thаt mаrgin-top crеаtеs а mаrgin on thе еlеmеnt, аnd top sеts thе top еdgе of thе еlеmеnt bеlow thе top еdgе of thе contаining еlеmеnt аt thе offsеt. just rеplаcе top with mаrgin-top to sее thе diffеrеncе.
Net Hosting Talk designed to bring both customers and web hosting providers together. Here you will find a community experience to learn everything related to web hosting. Get more experience as a System Administrator, Create your own hosting company.