を使用しているとき、私は5pxの幅を持っており、上部に座ることになっている4つのdiv要素(複数可)を作成しようとしています表示されない、下、ビューポートの左右のマージン、基本的にすべてをまとめてページのフレームまたは枠として機能させます。関数を呼び出し、左右のdiv(すなわちedgeLとedgeRとが)正常に表示されるいくつかの理由から、いくつかのdiv要素(複数可)のcreateElementとのappendChild
function border() {
edgeT = document.createElement('div');
edgeT.style.position = "fixed"
edgeT.style.left = 0;
edgeT.style.top = 0;
edgeT.style.right = 0;
edgeT.style.width = "5px";
edgeT.style.backgroundColor= "black";
document.body.appendChild(edgeT);
edgeB = document.createElement('div');
edgeB.style.position = "fixed"
edgeB.style.left = 0;
edgeB.style.right = 0;
edgeB.style.bottom = 0;
edgeB.style.width = "5px";
edgeB.style.backgroundColor= "black";
document.body.appendChild(edgeB);
edgeL = document.createElement('div');
edgeL.style.position = "fixed"
edgeL.style.left = 0;
edgeL.style.top = 0;
edgeL.style.bottom = 0;
edgeL.style.width = "5px";
edgeL.style.backgroundColor= "black";
document.body.appendChild(edgeL);
edgeR = document.createElement('div');
edgeR.style.position = "fixed"
edgeR.style.top = 0;
edgeR.style.bottom = 0;
edgeR.style.right = 0;
edgeR.style.width = "5px";
edgeR.style.backgroundColor= "black";
document.body.appendChild(edgeR);
}
が、edgeTとEDGEB(の痕跡はありません。ここで
は私のコードです上部と下部のもの)。コードが4つのすべてのコードとまったく同じである理由は分かりません。この問題はChromeとFirefoxの両方で関連しています
は、私は同じ結果を達成するためにCSSを使用することができます知っているが、これは主に学習運動ですので、私はまだこのケースで問題を引き起こしているかを理解したいと思います。
ご協力いただきありがとうございます。
よろしく、
ありがとうございました!その上半分の時間を費やし、完全に私は上部と下部のための高さではなく、幅を設定していることを見落として... :) – fcorte