简体   繁体   中英

CSS / Javascript - how to place a nextParticle image in the centre of a screen

I'm working on a codepen demo using a particle-slider effect on a logo image and I can't seem to apply any styling rules to the image at all. I'm attempting to centralise the image, at the moment its stuck on the left and I can't get it to move. I've tried a few different angles but nothing. This is the link

HTML

<body>  
        <img id="logo" class="next-particle"  data-init-position="random"
                  data-init-direction="left"
                  data-fade-position="left"
                  data-fade-direction="left"

                  data-particle-gap="1"

                 data-width="800"
                  data-height="600"

                  data-max-width="700"
                  data-max-height="500"



                  data-mouse-force="80"

                   data-gravity="0.06"

                   data-noise="20"

                 src="http://res.cloudinary.com/mrmw1974/image/upload/v1513726195/XBD1_dqjlw5.png">

</body>

CSS

body {
  position: relative;
}

#logo img {
 position: absolute;
  float: right;
}

Add align='center' to html tag

<html align='center'>
<head>
</head>
<style>
body {
  position: relative;
}

#logo img {
 position: absolute;
  float: right;
}
</style>
<body>  
        <img id="logo" class="next-particle"  data-init-position="random"
                  data-init-direction="left"
                  data-fade-position="left"
                  data-fade-direction="left"

                  data-particle-gap="1"

                 data-width="800"
                  data-height="600"

                  data-max-width="700"
                  data-max-height="500"



                  data-mouse-force="80"

                   data-gravity="0.06"

                   data-noise="20"

                 src="http://res.cloudinary.com/mrmw1974/image/upload/v1513726195/XBD1_dqjlw5.png">

</body>
</html>

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM