Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vertical align middle for h3 tag not working

Tags:

html

css

Here is what I need the output to be.

enter image description here

HTML Markup is:

<h3 class="TRM_Propane_sfty_ttl">Placement of Your Grill &amp; Propane Cylinders</h3>
<h3 class="TRM_Propane_sfty_ttl">Use of Your Grill</h3>
<h3 class="TRM_Propane_sfty_ttl">Other Propane Cylinder Safety Tips</h3>

What is the CSS I should apply to the h3 tag, so that the text "Use of Your Grill" will be vertically aligned at middle? I should n't use specific line height for the second h3 tag.

I tried display: table, table-cell, table-head. Nothing worked :(

like image 728
Vel Murugan S Avatar asked Dec 29 '25 10:12

Vel Murugan S


1 Answers

h3 is block level (that is the next element will go to the next line) so one way is to make that inline (like span element).

.TRM_Propane_sfty_ttl 
 {display:inline;}

in your CSS.

Check my demo with table also by the way is used.

And without using h3 element you could also make your font look bigger like this one and your code a little tidier ;-)

like image 129
Edper Avatar answered Dec 31 '25 05:12

Edper



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!