Reputation: 3139
I'm building a chrome extension that uses HTML injection to insert my own DIV into a page. I want to resize it but I don't have access to the CSS. Is it possible to somehow force my div to resize it's width using HTML or javascript?
Upvotes: 0
Views: 75
Reputation: 73291
It works with javascript or with inline css here's how to:
HTML:
<div id="div" style="width:20px;height:20px;"></div>
Javascript:
var a = document.getElementById('div');
a.style.width = '200px';
a.style.height = '200px';
Upvotes: 0
Reputation: 12970
You can resize it using javascript like so:
document.getElementById('yourDivId').style.height = "500px";
document.getElementById('yourDivId').style.width = "500px";
You could also try setting or adding the height attribute via JavaScript as well.
document.getElementById('yourDivId').setAttribute("height", "500px");
document.getElementById('yourDivId').setAttribute("width", "500px");
Upvotes: 1