M
M
Mikhail Pakhmutov2013-12-18 17:02:42
css
Mikhail Pakhmutov, 2013-12-18 17:02:42

execCommand: how to use CSS in IE to set text-align option?

Hello. I'm trying to create my own wysiwyg editor, but I need to make sure that the code is the same in all browsers (why? below). When setting text centering in all browsers except IE, it happens like this:
<div style="text-align:center;"></div>
In IE, for some reason, html parameters are used and it turns out like this:
<div align="center"></div>
I tried to set styleWithCSS, it didn’t work, maybe I didn’t use
it
correctly
The code must be the same so that if the same code is opened in another browser, the parameters will not be generated.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
C
Codebaker, 2013-12-18
@Codebaker

<div align="center" style="text-align:center;"></div>

If via CSS:
.yourClass
{
    text-align: center;
    align: center;
}

M
Mikhail Pakhmutov, 2013-12-18
@ARCHANG3L

Do you mean assign a class?
It is required to make the command
set the parameter via CSS

K
Kirill Popolov, 2013-12-19
@ezhikov

yourelement.style.textCss = "text-align: center";

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question