-1

Hi i am currently working with rails 4.2 and using sass , and haml . I am trying to center align the h5 that i have but it seems that it doesnt want to cooperate with me and i already tried with the search with google but still a fail

this is my code

the static page is this

.row#mod
    .container#space
        .row
            .col-md-2
                .thumbnail
                    .caption
                        =image_tag "a.png", tag: "",class: "img-thumbnail"
                        %h5
                            %b#tag Lead
                        %br

The sass is this

#tag
    text-align: center

but the center alignment of the h5 is still to no avail can anybody help me and thanks

user1868185
  • 889
  • 2
  • 9
  • 21
  • This is not a Rails or Sass problem, provide the compiled markup/CSS. – cimmanon Nov 01 '15 at 11:04
  • Is this to style just the one h5 tag on the page, other wise make the styling more generalised to something like '.thumbnail .caption h5' and add 'text-align: center' to that. – Sean Murrin Nov 01 '15 at 11:15

1 Answers1

0

The id tag is on the inline element <b>, so text-align: center won't center it within the block h5 element. You can either make #tag display: block, or you should move text-align: center to the h5.

Example 1:

#tag
    display: block
    text-align: center

Example 2:

.caption h5
    text-align: center
devitall
  • 31
  • 4