+ 1
how to align text that is in document.getElement()
3 ответов
+ 1
you can give your text an id then style in css, for example
html
<p id="foo">Random text </p>
css
#foo {
text-align:center;
}
js
document.getElementById("foo");
if you wanted to do it in js instead of css it would look like this
html
<p id="foo">Random text </p>
js
var x = document.getElementById("foo");
x.style.textAlign="center";
+ 1
thanks Matt
+ 1
yes he is right both are perfect