I need to know how to set an html page to only open at a set size. I had learned this in my basic htm code class a long time ago but have forgotten and can't seem to find any instructions about how to do this.

I have dreamweaver 8 but am pretty new in the software and can't seem to find any help in the Help section

Thanks

Dani AI

Generated

You cannot force an HTML document to open at a fixed size. The browser window is under the user’s control. As and note, scripts can only resize windows they themselves opened, and even those are tightly limited and often blocked unless triggered by a user gesture. Framesets, as warned, are obsolete today; use CSS layout instead. (developer.mozilla.org)

If your goal (like ’s) is “shrink to fit, but not below X,” do it with responsive CSS. First, set the viewport so mobile browsers size correctly:

<meta name="viewport" content="width=device-width, initial-scale=1.0">

Then constrain your layout with a fluid-but-bounded wrapper and a flexible grid:

.page {
  width: clamp(320px, 100%, 1200px); /* min 320px, prefer 100%, max 1200px */
  margin: 0 auto;
  padding: 1rem;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
@media (max-width: 600px) {
  .sidebar { display: none; } /* example tweak for very small screens */
}

This approach lets the page scale to the viewport, but it stops shrinking below your minimum and never grows beyond your max. It uses the viewport meta tag, media queries, CSS Grid’s minmax(), and the clamp() function. (developer.mozilla.org)

Practical tips: avoid fixed heights so content can scroll; make images fluid with img{max-width:100%;height:auto;}; and steer clear of popups for layout since window.open() and resizing are restricted and can degrade UX. (developer.mozilla.org)

Recommended Answers

All 6 Replies

There is no such thing as a "page size" in HTML. The user can size their browser to any size they wish. That's as it should be.

JavaScript does provide, however, a window.resize() method. Using it creates a very negative user experience. The only way I've seen this work well is for your main page to open a new window, and size the new window. Use the window.open() method.

Javascript can only size or resize a window that has been opened with javascript.

I have a similar problem. I am designing a website but would like it so that if someone using a smaller screen is viewing the site, my site shrink to fit there browser size. But I would also like it to stop shrinking at a certain size

hi every one
this is the way to set HTML page

<HTML>
<HEAD>
<TITLE>A simple frameset document</TITLE>
</HEAD>
<FRAMESET cols="20%, 80%">
  <FRAMESET rows="100, 200">
      <FRAME src="contents_of_frame1.html">
      <FRAME src="contents_of_frame2.gif">
  </FRAMESET>
  <FRAME src="contents_of_frame3.html">
  <NOFRAMES>
      <P>This frameset document contains:
      <UL>
         <LI><A href="contents_of_frame1.html">Some neat contents</A>
         <LI><IMG src="contents_of_frame2.gif" alt="A neat image">
         <LI><A href="contents_of_frame3.html">Some other neat contents</A>
      </UL>
  </NOFRAMES>
</FRAMESET>
</HTML>

With a few wee changes I managed to get that code to work with my site.

Cheers
--
monkeymack2

framesets are outdated, and if you were to look ath the results of whatever code you developed from the BS supplied as a fix on any other browsers or screen resolution, it looks nothing like you expect
current best practice for screen layout ueses ems and % sized elements as per W3c guidelines, and nothing uses frames

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.