In the latest HTML standard, there is a calc CSS expression that we can use to calculate the layout. But it is not supported in the old IE. In order to support all browsers, js is used here. screenshot: ![]() code: Copy code The code is as follows:<!DOCTYPE HTML PUBLIC "-//IETF//DTD LEVEL1//EN"> <html> <head> <title>MyHtml.html</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="this is my page"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <script> var left,center,right,width; window.onload = function(){ left=$('left'); center=$('center'); right=$('right'); onresize(); }; window.onresize = function() { try { width = document.body.clientWidth; center.style.width = (width - left.clientWidth - right.clientWidth - 0) + "px"; }catch(e){ //If it is less than 0, an error will be reported } }; function $(id){ return document.getElementById(id); } </script> <style> body,html{ height:100%; margin:0px; padding:0px; overflow:hidden; } #left,#center,#right width:200px; height:100px; background-color:rgb(34,124,134); float:left; height:100%; } #center{ background-color:red; } </style> </head> <body> <div id="left"></div> <div id="center"></div> <div id="right"></div> </body> </html> |
<<: PHP-HTMLhtml important knowledge points notes (must read)
>>: Vue achieves the top effect through v-show
Anyone who has read my articles recently knows th...
I think the commands I use most often are: Choice...
Table of contents Common array methods pop() unsh...
Apache Arrow is a popular format used by various ...
BEM from QQtabBar First of all, what does BEM mea...
HTML tag: superscript In HTML, the <sup> tag...
This article shares the specific code for JavaScr...
This article mainly introduces the example of rea...
React is different from Vue. It implements route ...
This article example shares the specific code of ...
Preface During the development process, you will ...
In this article, we sorted out the startup proces...
Preface I recently encountered a problem at work....
In react-router, the jump in the component can be...