Can't center content horizontally

Nidhin Radh

I'm creating a website using bootstrap framework. I have also used particle.js for the background. There are three rows in the page in which each contain 1 element. The first row contain an image, second row contain some text and the third one contain a button. I want all these to be horizontally in the center of each row. But in the output the right padding is higher than left padding. Here is my code,

    <body  id="particles-js" >
            <div class="container-fluid">
                <div class="row">
                    <div class="col-md-12 text-center">
                        <img src="images/logo2.png" class="img-responsive my-logo">
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-8 text-center col-md-offset-2">
                        <h3 class="head">The Text goes Here !!!</h3>
                    </div>
                </div>
                <div class="row">
                    <div class="text-center col-md-4 col-md-offset-4">
            <myButton>Button Text Here!</myButton>
                    </div>
                </div>
            </div>
      </body>

The style I have given manually is as foloows,

        <style type="text/css">
            #particles-js{
            background: url(images/bg11.jpg) no-repeat center center fixed;
            height:100vh;
            -webkit-background-size: cover;
            -moz-background-size: cover;
            -o-background-size: cover;
            background-size: cover;
            }
            .container-fluid{
            all: initial !important;
            position: absolute !important; 
            top: 0 !important; 
            pointer-events:none !important;
            }
            .head{
            font-family: 'Exo', sans-serif;
            color:#fff;
            font-size: 35px;
            }
            myButton {
            background-color:transparent;
            border:1px solid #ff0044;
            display:inline-block;
            cursor:pointer;
            color:#ffffff;
            font-family:Arial;
            font-size:20px;
            padding:17px 60px;
            text-decoration:none;
            text-shadow:0px 1px 0px #ff0044;
            }
            myButton:hover {
            background-color:#ff0044;
            }
            myButton:active {
            position:relative;
            top:1px;
            }
            .my-logo{
            all: initial!important;
            width: auto!important;
            max-height: 50vh!important;
            pointer-events: none !important;
            }
        </style>

How can i place these contents in the center of each div?

Dražen

Particle.js is a canvas thing, if you assign elements within the block they will either be insivible, positioned with a weird margins, or unclicable/hoverable.

Assign particles to its own div, make it absolute (which is stated in documentation!!!) and then add your own content in another div which may have bigger z-index then your particles.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Can't get my footer content to center

From Dev

Center content of TextView vertically & horizontally - LinearLayout

From Dev

center div content vertically and horizontally not work

From Dev

Issue in fixing the content in the center both horizontally and vertically

From Dev

Can't seem to horizontally center text that has been translated 270 deg?

From Dev

Why can't I use flex box in this div to center it both horizontally and vertically?

From Dev

How can I horizontally center a UIView?

From Dev

Why won't this <ul> center perfectly horizontally?

From Dev

I can't align center a content by using CSS

From Dev

How to horizontally center content of iframe (Google Map)? Usual methods not working

From Dev

How can I center content

From Dev

Can't center menu

From Dev

Can't center this form

From Dev

How can I horizontally center a single line of text in UITextView?

From Dev

Can flexbox horizontally and vertically center images without stretching them?

From Dev

How Can I Put Bootstrap Modal in Horizontally center?

From Dev

JavaFX: How can I horizontally center an ImageView inside a ScrollPane?

From Dev

How can I horizontally and vertically center this four divs contents?

From Dev

How can I center horizontally a Grid-block inside of a div?

From Dev

How can i vertically and horizontally center an asp button in bootstrap

From Dev

Bootstrap Carousel Image Doesn't Align Center Horizontally

From Dev

Why won't my list align horizontally center

From Dev

Can't horizontally split the screen with GNOME 3

From Dev

Can't get navigation bar to display horizontally

From Dev

Can't horizontally split the screen with GNOME 3

From Java

How to horizontally center a <div>

From Dev

How to horizontally center an element

From Dev

Horizontally center multiple UIViews

From Java

Center View horizontally in SwiftUI

Related Related

  1. 1

    Can't get my footer content to center

  2. 2

    Center content of TextView vertically & horizontally - LinearLayout

  3. 3

    center div content vertically and horizontally not work

  4. 4

    Issue in fixing the content in the center both horizontally and vertically

  5. 5

    Can't seem to horizontally center text that has been translated 270 deg?

  6. 6

    Why can't I use flex box in this div to center it both horizontally and vertically?

  7. 7

    How can I horizontally center a UIView?

  8. 8

    Why won't this <ul> center perfectly horizontally?

  9. 9

    I can't align center a content by using CSS

  10. 10

    How to horizontally center content of iframe (Google Map)? Usual methods not working

  11. 11

    How can I center content

  12. 12

    Can't center menu

  13. 13

    Can't center this form

  14. 14

    How can I horizontally center a single line of text in UITextView?

  15. 15

    Can flexbox horizontally and vertically center images without stretching them?

  16. 16

    How Can I Put Bootstrap Modal in Horizontally center?

  17. 17

    JavaFX: How can I horizontally center an ImageView inside a ScrollPane?

  18. 18

    How can I horizontally and vertically center this four divs contents?

  19. 19

    How can I center horizontally a Grid-block inside of a div?

  20. 20

    How can i vertically and horizontally center an asp button in bootstrap

  21. 21

    Bootstrap Carousel Image Doesn't Align Center Horizontally

  22. 22

    Why won't my list align horizontally center

  23. 23

    Can't horizontally split the screen with GNOME 3

  24. 24

    Can't get navigation bar to display horizontally

  25. 25

    Can't horizontally split the screen with GNOME 3

  26. 26

    How to horizontally center a <div>

  27. 27

    How to horizontally center an element

  28. 28

    Horizontally center multiple UIViews

  29. 29

    Center View horizontally in SwiftUI

HotTag

Archive