Core: Positioning Elements
var qaTrinity = ; qaTrinity = new Image(); qaTrinity.src = "Creation_Michelangelo_1.jpg" qaTrinity.style.position = "absolute"; qaTrinity.style.left = "250px"; qaTrinity.style.top = "50px"; document.body.appendChild(qaTrinity); qaTrinity = new Image(); qaTrinity.src = "TheDescentOfTheHolyGhost_Titian_2.jpg" qaTrinity.style.position = "absolute"; qaTrinity.style.left = "450px"; qaTrinity.style.top = "250px"; document.body.appendChild(qaTrinity); qaTrinity = new Image(); qaTrinity.src = "TheLastJudgment_Michelangelo_3.jpg" qaTrinity.style.position = "absolute"; qaTrinity.style.left = "50px"; qaTrinity.style.top = "250px"; document.body.appendChild(qaTrinity);
The positioning in this lesson is called absolute and is different from the static positioning used in the prior lesson. Static positioning is where the images are laid out in left to right and then top to bottom order, much like reading. We did not need to specify the positioning as static in the last lesson because it is the default when nothing else is specified. However, explicitly setting the positioning to static will not cause problems and may be advantageous in some cases.