Setting the width and height not working on a very simple sample

I have made a very simple experiment with a scatter plot.
I then tried to set the width and height and it did not work.
I have tried to follow an example in this forum but to no avail.

Here is my first experiment:

https://jsfiddle.net/taq7sd4y/

and this is my second one:

https://jsfiddle.net/taq7sd4y/1/

Can anyone tell me were I am have made an error?

TIA.

This is your code :

`<div id="myDiv2"
         style="display: block; text-align:center; height=500px; width=900px; border:1px solid black;">
        <!-- Fig 2: Plotly chart will be drawn inside this DIV -->
    </div>`

You have used equal sign instead of colon (:).
So the correct code would be :
<div id="myDiv2" style="display: block; text-align:center; height:500px; width:900px; border:1px solid black;"> <!-- Fig 2: Plotly chart will be drawn inside this DIV --> </div>
It’s more suitable to use percentages rather than px values.

Oops. Copy &paste from iFrame.
Appreciate the advice to use %.

Thank you.

three reasons why you should buy plotly pro: support open source, get great support, host your plots and dashboards online