css - Why is this working differently in firefox, chrome and IE? -


i wanted ask following :

  1. why table behave in strange way in different browsers? behavior same other tags??even data, though being repeatedly centered doesn't displays way should.is wrong way used 'test-align'? (i have not found out yet differences other tags)

2.when try put 'id' attribute in why appears behave block element??

3.how can change onmouseout not close until mouse out option displayed??

body {  margin:0px;  padding:0px  }    #header {  height:150px;  background-color:green;  margin:10px;  }    #navbar {  height:60px;  background-color:teal;  text-align:center;  margin:10px;  padding:0px;  }      #hlink1{  background-color:lime;  text-align:center;  height:40px;  padding:3px;  margin-left:0px;  margin-right:0px;  margin-top:5px;  margin-bottom:5px;  }    #hlink2{  background-color:lime;  text-align:center;  height:40px;  padding:3px;  margin-left:0px;  margin-right:0px;  margin-top:5px;  margin-bottom:5px;  }    #hlink3{  background-color:lime;  text-align:center;  height:40px;  padding:3px;  margin-left:0px;  margin-right:0px;  margin-top:5px;  margin-bottom:5px;  }    #hlink1:hover{  background-color:aqua;  text-align:center;  }    #hlink2:hover{  background-color:aqua;  text-align:center;  }    #hlink3:hover{  background-color:aqua;  text-align:center;  }      table {  width:100%;  border-collapse: collapse;  text-align:center;  }    #data3 {  background-color:lime;  padding:5px;  height:0px;  display:none;  }    #data2 {  background-color:lime;  padding:5px;  text-align:center;  height:0px;  display:none;  }    #data1 {  background-color:lime;  padding:5px;  text-align:center;  height:0px;  display:none;  }    .inn:hover{  background-color:aqua;  }
<html>  <head>  <title>experiment</title>  <link rel="stylesheet" type="text/css" href="nav.css" />  </head>  <body>    <div id="header">  </div>    <div id="navbar">  <table>  	<th onmouseover="document.getelementbyid('data1').style.display='inline';" onmouseout="document.getelementbyid('data1').style.display='none';">  	<div id="hlink1">heading_link1</div>  	</th>  	<th onmouseover="document.getelementbyid('data2').style.display='inline';" onmouseout="document.getelementbyid('data2').style.display='none';">  	<div id="hlink2">heading_link2</div>  	</th>  	<th onmouseover="document.getelementbyid('data3').style.display='inline';" onmouseout="document.getelementbyid('data3').style.display='none';">  	<div id="hlink3">heading_link3</div>  	</th>  	<tr>  		<td colspan="1">  		<table  id="data1">  			<tr><td class="inn">data</td></tr>  			<tr><td class="inn">data</td></tr>  			<tr><td class="inn">data</td></tr>  			<tr><td class="inn">data</td></tr>  		</table>  		</td>  	  		<td>  		<table  id="data2">  			<tr><td class="inn">data</td></tr>  			<tr><td class="inn">data</td></tr>  			<tr><td class="inn">data</td></tr>  			<tr><td class="inn">data</td></tr>  		</table>  		</td>    	  		<td>  		<table  id="data3">  			<tr><td class="inn">data</td></tr>  			<tr><td class="inn">data</td></tr>  			<tr><td class="inn">data</td></tr>  			<tr><td class="inn">data</td></tr>  		</table>  		</td>  	</tr>  	</table>  </div>  </body>  </html>

you should not try change display value of table without changing display values of structure inside it. while not technically error, amounts putting tr inside span; browsers apparently handle differently.
if change mouseover events read

document.getelementbyid('data1').style.display='table'; 

they act same in browsers.

as point 3, may require little change in structure. currently, data tables in different rows hover rows, don't influence each other. if put data tables directly inside header cells, it's easier hovering; won't need javascript events.

<th>   <div id="hlink1">heading_link1</div>   <table  id="data1">     <tr><td class="inn">data</td></tr>     <tr><td class="inn">data</td></tr>     <tr><td class="inn">data</td></tr>     <tr><td class="inn">data</td></tr>   </table> </th> 

and css:

#navbar th:hover table {   display:table } 

no need spell out onmouseover actions in each of header cells!

body {    margin:0px;    padding:0px  }    #header {    height:150px;    background-color:green;    margin:10px;  }    #navbar {    height:60px;    background-color:teal;    text-align:center;    margin:10px;    padding:0px;  }      #hlink1, #hlink2, #hlink3 {    background-color:lime;    text-align:center;    height:40px;    padding:3px;    margin-left:0px;    margin-right:0px;    margin-top:5px;    margin-bottom:5px;  }    #hlink1:hover, #hlink2:hover, #hlink3:hover{    background-color:aqua;  }    table {    width:100%;    border-collapse: collapse;    text-align:center;  }    #data1, #data2, #data3 {    background-color:lime;    padding:5px;    display:none;  }    .inn:hover{    background-color:aqua;  }    #navbar th {    vertical-align:top;  }    #navbar th:hover table {    display:table  }
<html>    <head>      <title>experiment</title>      <link rel="stylesheet" type="text/css" href="nav.css" />    </head>    <body>        <div id="header">      </div>        <div id="navbar">        <table>          <th>            <div id="hlink1">heading_link1</div>            <table  id="data1">              <tr><td class="inn">data</td></tr>              <tr><td class="inn">data</td></tr>              <tr><td class="inn">data</td></tr>              <tr><td class="inn">data</td></tr>            </table>          </th>          <th>            <div id="hlink2">heading_link2</div>            <table  id="data2">              <tr><td class="inn">data</td></tr>              <tr><td class="inn">data</td></tr>              <tr><td class="inn">data</td></tr>              <tr><td class="inn">data</td></tr>            </table>          </th>          <th>            <div id="hlink3">heading_link3</div>            <table  id="data3">              <tr><td class="inn">data</td></tr>              <tr><td class="inn">data</td></tr>              <tr><td class="inn">data</td></tr>              <tr><td class="inn">data</td></tr>            </table>          </th>        </table>      </div>    </body>  </html>


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -