C
C
Clever_Coyote2016-01-31 17:28:41
css
Clever_Coyote, 2016-01-31 17:28:41

How to fix a bug in FF (horizontal and vertical centering)?

Good day.
The task is to center the block with the diagram horizontally and vertically. In ie11, chrome and safari everything works as it should, but in FF it crashes, I can't figure out what the problem is.
Code example

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Sergeevich, 2016-01-31
@Clever_Coyote

Try like this:

canvas {
  display: block;
  position: absolute;
  top:50%;
  left:50%;
  margin: auto;
  transform: translateX(-50%) translateY(-50%);
  width: 20%;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question