Git Product home page Git Product logo

Comments (7)

hsnaydd avatar hsnaydd commented on August 19, 2024

Hi @Gillesvk

Can you show me an example on CodePen ?

from moveto.

Gillesvk avatar Gillesvk commented on August 19, 2024

Here is a link to a very simple example : codepen
As you will see, the top margin of the first section is ignored.

from moveto.

hsnaydd avatar hsnaydd commented on August 19, 2024

This is not a bug, it's a normal css behavior. The first section's margin is collapsing. You can check this link for more information.

from moveto.

Gillesvk avatar Gillesvk commented on August 19, 2024

Actually, it's not a margin collapsing issue because I apply only top margin on the child elements of the body, so there is no adjacent margin interference. In the codepen, I changed the background color of the body to pink and, as expected, the body contains the top margin of the first section.

Maybe, it's something to do with the choice between :

  • window.scrollY,
  • window.pageYOffset,
  • document.body.scrollTop,
  • document.documentElement.scrollTop

See this link

from moveto.

hsnaydd avatar hsnaydd commented on August 19, 2024

Check this codepen;

I added

display: flex;
flex-direction: column

to the body to prevent margin collapsing. As I said before, It seems like this is margin collapsing. Also you can see it clearly with inspect in the browser,

from moveto.

Gillesvk avatar Gillesvk commented on August 19, 2024

OK, thanks. Your plugin is awesome. So light.

from moveto.

hsnaydd avatar hsnaydd commented on August 19, 2024

You're welcome @Gillesvk , have a nice day 😉

from moveto.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.