Search code examples
cssmargins

Problems with vertical margins in CSS


In this page I'm trying to vertically center the text "Details..." with "XYZ" using margin-top and margin-bottom, but to no avail. I also want to decrease the space between title and table.

enter image description here

Strange thing: when I put the red border around the title to see what I did wrong, the centered text dropped below the left and right floats (see bottom image). I just added a border, nothing else was changed.

Can someone please have a look at my code and suggest how to vertically align the title, and decrease the space below it?


Solution

  • give float to your div. without float property these all problems are occurring.

    .class{
        float:left;
        width:100%;
    }
    

    Check this Link