Text Centerd & Verical Middle using CSS in HTML | Techbirds

Posted on: May 29, 2014 /

Categories: HTML5/Design / Author Name: Ankit Awasthi

I was facing problem to align content vertically or horizontally center than I use this code to resolve the issue.

Html 5 .container{ height:500px; width:500px; text-align:center; display:table-cell; vertical-align:middle; background:red; font-size:30px; color:#fff; font-family:verdana; } Centered text in Middle

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

    

        Html 5

        

            .container{

                height:500px;

                width:500px;

                text-align:center;

                display:table-cell;

                vertical-align:middle;

                background:red;

                font-size:30px;

                color:#fff;

                font-family:verdana;

            }

        

    

    

        

            Centered text in Middle

        

    

Thanks

862 total views, 1 views today

Share this Onfacebook-3977240twitter-3686644linkedin-4048634google-7962588