How to align JSF components to center

前端 未结 4 1255
执念已碎
执念已碎 2020-12-28 22:09

In my JSF 2 - Primefaces 3 web application, I am using and . I have multiple components inside them which are le

4条回答
  •  不思量自难忘°
    2020-12-28 22:30

    Look at the generated HTML output and alter CSS accordingly.

    If the HTML element which you'd like to center is a block element (

    ,

    ,

    , , etc, or forced by display: block;), then you first need to give it a known width and then you can center it relative to its parent block element using CSS margin: 0 auto; on the element itself.

    If the HTML element which you'd like to center is an inline element (, , , , etc, or forced by display: inline;), then you can center it using CSS text-align: center; on its parent block element.

    提交回复
    热议问题