+ 2

how do i align the paragraph to the middle of the div? code is in the description.

HTML: <div><p></p></div> CSS: div { height: 500px; background-color: blue; } p { height: 100px; background-color: black; }

12th Apr 2017, 3:41 AM
chris
chris - avatar
3 Answers
+ 5
Change CSS div { display: table-cell; height: 300px; width: 300px; background-color: #e3e3e3; margin: auto auto; text-align: center; vertical-align: middle; }
12th Apr 2017, 4:20 AM
à€Šà„‡à€”à„‡à€‚à€Šà„à€° à€źà€čà€Ÿà€œà€š (Devender)
à€Šà„‡à€”à„‡à€‚à€Šà„à€° à€źà€čà€Ÿà€œà€š (Devender) - avatar
+ 1
just out margin auto for the <p>. that should do it. or text align center/justify.
12th Apr 2017, 11:34 AM
theBlueGHOST
theBlueGHOST - avatar
0
Hi, can anyone help me please
12th Apr 2017, 1:12 PM
Jorge ramos