I recently used JavaScript to insert an image into a webpage, but I'm unsure of how to make changes to it or position it properly. Is there a way to connect CSS styles to the image, or is there another method to modify it without relying on CSS?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8>
<title>Custom Image</title>
<link rel="stylesheet" href="CSS/style.css">
</head>
<body>
<script>
function displayImage() {
var img = new Image();
img.src = 'img/custom.jpg';
document.body.appendChild(img);
}
</script>
<p>Check out this image below:
<script>
displayImage();
</script>
</p>
</body>
</html>