<!DOCTYPE html>
<html>
<body>

<p id="myP">This is a paragraph.</p>

<button type="button" onclick="myFunction()">Set font</button>
 
<script>
function myFunction() {
    document.getElementById("myP").style.font = "italic bold 20px arial,serif";
}
</script>

</body>
</html>