+ 1

how to align text that is in document.getElement()

11th Jun 2016, 5:40 AM
PRADEEP A
PRADEEP A - avatar
3 Réponses
+ 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";
13th Jun 2016, 6:28 AM
Matt
+ 1
thanks Matt
13th Jun 2016, 8:02 AM
PRADEEP A
PRADEEP A - avatar
+ 1
yes he is right both are perfect
1st Jul 2016, 4:31 PM
Cele Prince
Cele Prince - avatar