Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Height auto should be whole number

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #261422
    Vishal Somani
    Participant

    If I give height as Auto to div, how can I prevent that value not to be decimal.

    #261424
    Paulie_D
    Member

    Sorry, I don’t understand the question/issues. Can you provide a demo and more clearly state/describe the problem?

    #261427
    Vishal Somani
    Participant

    To display div in center we set margin as margin: 0 auto
    Here Top & bottom is 0 but left & right is auto that may be decimal (fractional) value.
    so can we restrict value must be whole number.

    #261431
    Paulie_D
    Member

    Basically, you can’t but I’m not sure why this is an issue.

    If there is a fractional pixel, most browsers will round this automatically.

    Other than that you would need Javascript.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.