How can I center the whole iframeset??

<html>
<head>
<style>
</style>
</head>
<frameset rows="100,*" frameborder="0" border="0" framespacing="0">
  <frame name="topNav" src="banner.php">
<frameset cols="200,*" frameborder="0" border="0" framespacing="0">
    <frame name="menu" src="menu.php" marginheight="0" marginwidth="0" scrolling="auto" noresize>
    <frame name="content" src="dashboard.php" marginheight="0" marginwidth="0" scrolling="auto" noresize>

</frameset>
</frameset>
</html>

I tried <div> and applying text-align:center; But It didnt work? !

有帮助吗?

解决方案 2

replace your frameset tags with these,

<frameset class="center" rows="100,*" frameborder="0" border="0" framespacing="0">
<frameset class="center" cols="200,*" frameborder="0" border="0" framespacing="0">

Addthese css codes for the page

.center
{
margin-left:auto;
margin-right:auto;
width:70%;
}

其他提示

You are either going to have to create a frame on the left and right sides, or just create an iframe and avoid the whole issue (better option). frameset is obsolete so you should avoid using it.

Declare the width of the div and apply:

margin:auto;

or

margin-left:auto;
margin-right:auto;

Working Sample

Additionally, please avoid using frameset in the future! It is obsolete in HTML5.

Cheers!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top