How to Create a Fixed-Width Layout with CSS

A "fixed-width" layout is one in which the layout of the page is contained within a wrapper that doesn't adjust its size when the width of the browser changes.

In this how to, you'll learn how to create a 2-column fixed-width layout.

  • Start with the following simple web page containing four content areas: header, footer, menu, and content. <!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> <title>Two-column fixed layout</title> </head> <body> <div id="wrapper"> <div id="header"> <h1>Two-column fixed layout</h1> </div> <div id="main"> <div id="menu"> <h2>Menu</h2> <p>This column is fixed.</p> <p>This column is fixed.</p> <p>This column is fixed.</p> <p>This column is fixed.</p> <p>This column is fixed.</p> </div> <div id="content"> <h2>Content</h2> <p>This column is fixed.</p> </div> <div class="clearer"></div> </div> <div id="footer">footer</div> </div> </body> </html>
  • Create a file for an external styesheet and link to it from the HTML using the following tag: <link href="fixed-two-column.css" rel="stylesheet">
  • Inside the stylesheet, start by resetting margins, padding, and borders: * { margin:0; padding:0; border:0; }
  • Next, add a border to the wrapper div: #wrapper { border: 1px solid #000; }
  • Add a bottom border to the header and give it some padding and a background: #header { border-bottom: 1px solid #000; padding: 10px; background-color: #eee; }
  • Float the menu nav left so that the content article will come up to its right edge. We'll also add some other styles to make it more readable and give it a width of 180px and padding of 10px, which gives it a total width of 200px: 180px + (2 x 10px): #menu { width: 180px; float: left; padding: 10px; border-right: 1px solid #000; }
  • Set the left margin of the content div to the total width of the menu div. We'll also add some other styles to make it look nicer: #content { margin-left: 200px; border-left: 1px solid #000; padding: 10px; line-height: 2em; }
  • Use a the clearer div to force the main section to extend its height when the content div expands. .clearer { clear: both; }
  • At this point, you have a fluid-width layout. To convert it to a fixed-width layout, simply add a fixed with to the #wrapper and set the margins to auto. Setting the margins to auto will cause the left and right margins to be equal no matter how wide the browser window is, which will cause your fixed-width layout to be positioned in the center of the browser. #wrapper { border: 1px solid #000; width: 950px; margin: auto; }

2-column fluid

Related Articles

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

How to keep website width fixed (irrespective of screen size)

I am designing a website. I want my website to be 980px width. I can easily do it on my laptop by setting the right and left fields of CSS Box as 15%. But my concern is that, when my website is opened on another PC with no widescreen, that 15% will create a distortion. I want to keep my website at 980px whatever be the screen size may be. Please help!

Screen shot of my website

4 Answers 4

Rather than trying to explicitly set the left and right margins, just have it auto center.

The key is the auto margin for left and right. This will horizontally align that 980px div in the center and keeping the width no matter what.

Dustin Laine's user avatar

I use the following style rules to create fixed-width cross-browser compatible layouts:

Put a div with ID "wrapper" inside your body tag, and the wrapper will always be at the center of the screen, and will always by 980px;

Starwarswii's user avatar

set the width on body tag and set CSS style align to center

AbhiRoczz...'s user avatar

Create a container div for the portion of the page that you want to be 980px, and set it to width: 980px; margin: 0 auto so that it will be centered and 980px.

Ian Pugsley's user avatar

Your Answer

Sign up or log in, post as a guest.

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service , privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged html css or ask your own question .

Hot Network Questions

how to make a web page fixed size

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .

Related Articles

Fixed Width Design

In the early days of the world wide web, the majority of people out there were using desktop computers. These days the web is available on laptops, phones, tablets, cars, etc. People expect that the website will look good on every device. Responsive design makes this possible. 

Responsive web design isn’t the first approach to building websites. Web developers and designers tried many other techniques before responsive web design. Among various other methods, one of them was fixed-width design.  

As the name implies “The width of your content is fixed” means, that no matter what your screen size is, the width of the content is going to be the same all the time. In the early age of the internet and the world wide web, most monitors had screen dimensions of (640 * 480) pixels , these were CRT monitors (Cathode Ray Tube monitors). So web designers and developers thought that it was a safer choice for them to design their website according to that dimensions only. 

As time goes, there were screens of sizes: 800*600 pixels , so the developers started feeling that designing their website for a fixed width of 800 pixels is a good choice for them. But again, the screen sizes change to 1024*768 pixels . Now, the developers had to design their website according to that screen size as well. It felt like a never-ending race among web designers, developers and hardware manufacturers.

Fixed Width Design means, when you specify a fixed width for your layout, that your layout will only look good at that specific width.

Note: The above number “1015” is just an example, you can use any value in place of that.

Approach:  Fixed-width is generally used when you don’t want the width of your content to change according to the changing width of the screen. To do so, you have to declare a width property in your CSS code with some value in it. Whether it was 640, 800, or 1080 pixels , choosing one specific width to design for is called fixed-width design. 

The CSS code of the below example is showing you a fixed-width design. You can easily see that we already defined the width of the body section as 640px which means no matter what the size of the screen will be, the body will always going to be 640px wide . And therefore restricting the web from being responsive.

Example 1: Below you will see an example of fixed width layout, where the units that we are using in the code are in pixels, which means the width is fixed and it will look good only in that specified width. Remember that it’s a fixed-width design, which means it will look good only on certain screen width and it’s not responsive. In responsive layout , we use rem/em units instead of px.

You can easily see in the above gif, that it is not adjusting the content as the screen width is changing because we have already declared a fixed width of certain pixels in our CSS code. This is called fixed-width layout. In the fixed-width layout, the content is not adjusted according to the changing screen width. That’s why it only looks good on one specific screen width. No matter what the screen size is, the content will go to cover only a certain portion of the screen.

Example 2: The below example will show you the comparison between fixed-width design and responsive design.

As you can see, in the GIF above, the black bar has a set size regardless of the pixel count on the screen, but the red bar changes size in response to the pixel count.

Please Login to comment...

Improve your Coding Skills with Practice

Start your coding journey now.

HTML vs Body: How to Set Width and Height for Full Page Size

CSS is difficult but also forgiving. And this forgiveness allows us to haphazardly throw styles into our CSS.

Our page still loads. There is no "crash".

When it comes to page width and height, do you know what to set on the HTML element? How about the body element?

Do you just slap the styles into both elements and hope for the best?

If you do, you're not alone.

The answers to those questions are not intuitive.

I'm 100% guilty of applying styles to both elements in the past without considering exactly which property should be applied to which element. 🤦‍♂️

It is not uncommon to see CSS properties applied to both the HTML and body elements like this:

Does It Matter?

Yes, yes it does.

The above style definition creates a problem:

Setting min-height to 100% on both elements does not allow the body element to fill the page like you might expect. If you check the computed style values in dev tools, the body element has a height of zero.

Meanwhile, the HTML element has a height equal to the visible part of the page in the browser.

Look at the following screenshot from Chrome Dev Tools:


Why Does This Happen?

Using a percentage as a size value requires the element to reference a parent to base that percentage on.

The HTML element references the viewport which has a height value equal to the visible viewport height. However, we only set a min-height on the HTML element... NOT a height property value.

Therefore, the body element has no parent height value to reference when deciding what 100% is equal to.

And The Problem May Be Hidden

If you started out with enough content to fill the body of the page, you might not have noticed this issue.

And to make it more difficult to notice, if you set a background-color on both elements or even on just one of them, the viewport is full of that color. This gives the impression the body element is as tall as the viewport.

It's not. It's still at zero.

The image above is taken from a page with the following CSS:


In a strange twist, the HTML element assumes the background-color of the body element if you don't set a separate background-color on the html element.

So What is the Ideal Height Setting for a Full Responsive Page?

For years, the answer was the following:

This allows the HTML element to reference the parent viewport and have a height value equal to 100% of the viewport value.

With the HTML element receiving a height value, the min-height value assigned to the body element gives it an initial height that matches the HTML element.

This also allows the body to to grow taller if the content outgrows the visible page.

The only drawback is the HTML element does not grow beyond the height of the visible viewport. However, allowing the body element to outgrow the HTML element has been considered acceptable.

The Modern Solution is Simplified

This example uses vh (viewport height) units to allow the body to set a minimum height value based upon the full height of the viewport.

Like the previously discussed background-color, if we do not set a height value for the HTML element, it will assume the same value for height that is given to the body element.

Therefore, this solution avoids the HTML element overflow present in the previous solution and both elements grow with your content!

The use of vh units did cause some mobile browser issues in the past, but it appears that Chrome and Safari are consistent with viewport units now .

Page Height May Cause a Horizontal Scrollbar

Wait, what?

Shouldn't this say "Page Width"?

In another strange series of events, your page height may activate the horizontal scrollbar in your browser.

When your page content grows taller than the viewport height, the vertical scrollbar on the right is activated. This can cause your page to instantly have a horizontal scrollbar as well.

So What is the Fix?

You may sleep better knowing it starts with a page width setting.

This problem arises when any element - not just the HTML or body element - is set to 100vw (viewport width) units.

The viewport units do not account for the approximate 10 pixels that the vertical scrollbar takes up.

Therefore, when the vertical scrollbar activates you also get a horizontal scrollbar.

How to Set the Page for Full Width

Maybe just don't.

Not setting a width on the HTML and body elements will default to the full size of the screen. If you do set a width value other than auto, consider utilizing a CSS reset first.

Remember, by default the body element has 8px of margin on all sides.

A CSS reset removes this. Otherwise, setting the width to 100% before removing the margins will cause the body element to overflow. Here's the CSS reset I use:

How to Set Width to Your Preference

While it may not always be necessary to set a width, I usually do.

It may simply be a habit.

If you set the width to 100% on the body element you will have a full page width. This is essentially equivalent to not setting a width value and allowing the default.

If you want to use the body element as a smaller container and let the HTML element fill the page, you could set a max-width value on the body.

Here's an example:

With no height value provided for the HTML element, setting the height and/or min-height of the body element to 100% results in no height (before you add content).

However, with no width value provided for the HTML element, setting the width of the body element to 100% results in full page width.

This can be counterintuitive and confusing.

For a responsive full page height, set the body element min-height to 100vh.

If you set a page width, choose 100% over 100vw to avoid surprise horizontal scrollbars.

I'll leave you with a tutorial from my YouTube channel demonstrating the CSS height and width settings for an HTML page that is full screen size and grows with the content it contains:

Do you have a different way of setting the CSS width and height that you prefer?

Let me know your method!

Hi, I'm currently working on a PhD in Information Systems. Also a full-time Solutions Architect & Developer. "Strive for progress, not perfection." Follow me on Twitter: @yesdavidgray

If you read this far, tweet to the author to show them you care. Tweet a thanks

Learn to code for free. freeCodeCamp's open source curriculum has helped more than 40,000 people get jobs as developers. Get started

This forum is now read-only. Please use our new forums! Go to forums

how to make a web page fixed size

how do you fit a webpage size to fit any screen size

ok i will like to know how do you fit your website size to fit any size because it seems that elements of my website are all around the place whenever i shrink the screen. thanks

Answer 5326c7059c4e9d92e9008b1b

well, the simple solution would be this: body { padding: 0; margin: 0; } (by defalut there is a margin of i believe 10px, so lets set it zero. now imagine i have a div inside my body: `

You can make it full screen using: div { width: 100%; height: 100%; }

this is not very efficient. since when the window is made small the page will become very small, happily we can fix that: div { width: 100%; height: 100%; min-width: 1000px; min-height: 1000px; }

now the div can’t be smaller then 1000px (which is not good news for mobile browser, but we will get back to that later). of course you could use em, em depends on the size of the font-size. so this: div { font-size: 16px; height: 2em; } the height of the the div is now 32px, (2*16) you can make it 16px (1em) or 8px (0.5em)

You can not really answer the question you asked, it is fully dependable of how you design your webpage. but since there are scripts that can tell if you have a mobile browsers you can use px as unit. and make a page for phones as well.

The only thing i can answer is what you see with a lot of webpages: full width but probably set width min-width to prevent shifting elements like you have or they make a central wrapper (just a div) and set it like this: div { height: auto; /*if more info comes on the page, it will stretch down*/ width: 1000px; margin: 0 auto; /*this will cause the div to be in the center*/ }

hopefully this answers some of your questions. If you have any questions, just ask them and i will do my best to answer them. But when visited website, try to figure out (just by thinking about how it could be designed) how it is designed. if you have an idea, take a look in the source code (most websites allow you to view source code) don’t worry about lot’s of thing you don’t know yet, that is just because mostly large websites are maintained by lots of people, to set up your own website you can do it a lot simpler but huge websites can give you useful code you can maybe use. also take a look at great site.

how to make a web page fixed size

thanks a lot for your help buddy

Answer 5327611d9c4e9d7538000177

if you have any other questions, just post them here (i will reply) If you might have visited my profile you have seen i have own site, if you want to know how to set up your site, i can help you.

how to make a web page fixed size

@stetim your reply has been of help to me as well…But I just wanna ask what would happen if I set my div’s width to auto in the Css editor, will that cause the div to stretch in size if there’s a ‘long’ content coming in? Also do you think it’s advisable to just go all the way with a background div and differentiating it from subsequent ones with an id?

Answer 532f452a7c82caa40e0078d7

good you ask questions, if you have more questions post them, no problem. You can do auto width but this will just keep stretching and stretching and stretching (infinite stretching) so yes, you can but i recommend you set a max-width. just like you set width: auto; you can add the property max-width: 1000px; for example (you can have both property’s) you can even add a min-width. (min-height and max-height as well of course).

The second question i do not fully understand. I think it is good to make a background-div yes. i also recommend in the start of your stylesheet to start with body { margin: 0; padding:0; }

since by default a margin set of 10px (which you want to control).

you can then add div’s in your central div (which i recommend to set to 100% with a min-width).

hope this answer your questions.

Popular free courses

Learn javascript.

CSS Tutorial

Css advanced, css responsive, css examples, css references, css height, width and max-width.

The CSS height and width properties are used to set the height and width of an element.

The CSS max-width property is used to set the maximum width of an element.

CSS Setting height and width

The height and width properties are used to set the height and width of an element.

The height and width properties do not include padding, borders, or margins. It sets the height/width of the area inside the padding, border, and margin of the element.

CSS height and width Values

The height and width properties may have the following values:

CSS height and width Examples

Set the height and width of a <div> element:

Try it Yourself »

Set the height and width of another <div> element:

Note: Remember that the height and width properties do not include padding, borders, or margins! They set the height/width of the area inside the padding, border, and margin of the element!


Setting max-width

The max-width property is used to set the maximum width of an element.

The max-width can be specified in length values , like px, cm, etc., or in percent (%) of the containing block, or set to none (this is default. Means that there is no maximum width).

The problem with the <div> above occurs when the browser window is smaller than the width of the element (500px). The browser then adds a horizontal scrollbar to the page.

Using max-width instead, in this situation, will improve the browser's handling of small windows.

Tip: Drag the browser window to smaller than 500px wide, to see the difference between the two divs!

Note: If you for some reason use both the width property and the max-width property on the same element, and the value of the width property is larger than the max-width property; the max-width property will be used (and the width property will be ignored).

This <div> element has a height of 100 pixels and a max-width of 500 pixels: 

Try it Yourself - Examples

Set the height and width of elements This example demonstrates how to set the height and width of different elements.

Set the height and width of an image using percent This example demonstrates how to set the height and width of an image using a percent value.

Set min-width and max-width of an element This example demonstrates how to set a minimum width and a maximum width of an element using a pixel value.

Set min-height and max-height of an element This example demonstrates how to set a minimum height and a maximum height of an element using a pixel value.

Test Yourself With Exercises

Set the height of the <h1> element to "100px".

Start the Exercise

All CSS Dimension Properties

Get started with your own server with Dynamic Spaces



Get your certification today!

how to make a web page fixed size

Get certified by completing a course today!


Report Error

If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:

[email protected]

Your Suggestion:

Thank you for helping us.

Your message has been sent to W3Schools.

Top Tutorials

Top references, top examples, web certificates, get certified.

how to make a web page fixed size

how to make a web page fixed size

how to make a web page fixed size

Adjusting your Websites to Fit all Types of Resolution Using HTML and CSS

how to make a web page fixed size


You might wonder that some web sites are flexible enough to adjust to any screen resolution. This capability can be approached by many ways, by using many web technologies, such like Javascript, Css, Html.

The article that I am going to write today is mainly focus on article specific content. There may be some points where I am not much considering since those are very basics on HTML and CSS.

Using the code

For some web developers are bit struggling to make their web site screen resolution adjusting. In order to give a unique experience to the user, this aspect is very critical. Since with the technology changes users are more into use different devices to browse internet. So it is very important that web site need to accommodate every resolution.

One of the easiest way is to make web site with percentage widths.

But this approach is less effective. If user loads the web site from a mobile device. It takes the width from screens 100%, which is very small amount of space.

Another approach can be give minimum width with percentages.

In above scenario web site decreases its web site only upto 1000px.

So lets take a look at a effective way of make a web site screen size adjustable by using some great things in HTML and CSS.

Lets look at what we are going to do. In this case I demonstrate this with different devices (Iphone 5, Galaxy S4, Windows Phone 920 and ITab 2). Also I tested it from two browsers Chrome, FireFox and IE, but in IE media queries doesn't work. I found a solution for it but didn't work.

Actually the technique that I am going to use can use in many different ways, I have dome my demonstration coding which matches to my scenario. Your development can differ that this. But my ultimate goal is to show how use this.

This is with full browser size.

Image 1

Browser reduced so that Advertisement area is hidden.

Image 2

Browser more reduced.

Image 3

Browser more reduced to make Image and Description align well.

Image 5

The design layout for the above web site is

Image 6

What need to be done;

First lets take a look at HTML

For above HTML markup I have mostly used semantic HTML. Which is Header, Footer, Aside, Section tags. Those tags allow you to define better meaning to the browser which improves the search engine readability.

In first line I have define the tags that says or instructs to the web browser about what version of HTML the page is written in. <!DOCTYPE html> means HTML 5.

And then I declared an attribute which specifies the xml namespace for a document.

Then I have used conditional comments that if browser is Internet Explore use the mentioned script that defines HTML 5 tags, because some of old IE browsers cannot identify HTML5 tags. Also I have imported css3-mediaqueries.js script since IE 8 or later does not support media queries.

Then I have used another conditional comment if browser is Not IE. In this statement I first check whether browsing device is a computer ( media="only screen" ), if so I import styles specific to computer screens that adjust for screen resolution. Then in second I check whether browsing device is mobile device ( media="only screen and (max-device-width: 480px) , only screen and (-webkit-min-device-pixel-ratio: 2) , screen and (-webkit-device-pixel-ratio:1.5)" ). Here I have used many media conditions,

First for Iphones screen and (max-device-width: 480px) next for Android Devices screen and (-webkit-min-device-pixel-ratio: 2) next for Iphones with retina display screen and (-webkit-device-pixel-ratio:1.5)

Then again I use another conditional comment for IEMobile browsers.

But here I need to say that. Making media queries compatible with IE 8 or later didn't work with css3-mediaqueries.js script. In a forum I saw that there are waiting for a new release of script.

Rest of the tags are pretty normal; where I wrap all the elements from Container div tag. Then Header tag that includes the web site Heading, next the Nav tag that includes navigation links; which I kept blank cause I don’t have any page navigating.

Then I declared a div that wraps all the content of the web page. I declared this to give a clear separation from Header tag and Footer tag.

Content div includes two main elements, one is <section> tag and <aside> tag. <section> tag defines sections in a web page and <aside> tag defines contents aside from the main content. Here I use <section> tag to include all the page content, such like posts, descriptions and <article> tag to hold Advertisements.

Inside <section> tag I declared an <article> which specifies independent, self-contained content. In <article> tag there are two elements that holds an image and some text.

So where does the Magic happens, it is all with CSS. Here I am not going to do any explanation with basic CSS properties, but I’ll concentrate more on tutorial specific properties.

First things first, lets set the layout of the web page.

First I removed the browser’s default page margin and padding. And set the background color and font.

Then I set the width for main wrapper; the div which I wraps all the page elements. As I discuss in the beginning of the tutorial it is always better to use percentages for widths, cause the the web page is more flexible for what ever the resolution that it’s works on. In this scenario web page container always takes 90% width from browser width. And by setting margin auto, it aligns the element to center of the web page.

Next I set the header element width of 100%; now here you have to make sure that it doesn’t take 100% from browser instead it takes 100% width from Container div. Also I set the height of 120px.

Footer, Nav and Content would looks same as header.

Now comes for a bit tricky point. How to make main_articles <section> tag display in left and the side_articles <aside> tag display in right. Well you could do it by using tables, no fuss at all. But to be frank using tables for page layout alignment is bit out-dated and less maintainable. Using <div> or <section> are always better and safe side.

To main_articles section I set width of 70% from width of Content div, then I make the section float left and to the side_article I declare width of 25% from content width makes it float right.

Image 7

Using float to adjust elements are now getting out-dated as well, so what’s the new thing?

Using flexbox is the new trend. Its improves the maintainability. First take a look at the layout that we use to display article description and image.

Image 8

Lets start, first we have to make the wrapping <article> tag (siteDescription) a flexbox. For that I set display: flexbox . Then I set the flex-direction: row .

Then I set the desImage <div> and des <div> flexbox items by setting their flexbox-order. Finally I set styles for the Advertisement <div> with width 90% from <aside> width.

Well we have done with initial layout.

Lets do the magic; magic is all with CSS @media queries. By using @media queries, we can have a different layout for screen, print, mobile phone, tablet, etc.

There are many media types.

You can refer more about @media queries at w3schools link: About Media Queries

Lets do some modification when screen comes to width of 900px;

When screen width comes to 900px width, I hide the <aside> advertisement section. After that I set the main_articles <section> element width of 90% to fill the space and siteDecription <article> element width of 100% to fill the space inside <article> element.

Then I want to do some space modification when the screen gets up to 700px, actually this is not much important but for my scenario it looks more cleaner.

Here I have reduce the header height and font size once the screen width 700px. And reduce the width of description <div> to 50% so it looks more aligned.

Now I do the biggest part, do modifications when screen upto width of 500px; I want to display my page like this.

Image 9

So now I don’t need all flexbox stuff. All I need is to do some basic adjustments. Where Image and Description <div> to take 90% width. As earlier I reduce the header height and font size. Then I hide the advertisement are. Then I set main_articles <section> to take width of 90% and siteDescription <article> to take width of 95% from main_articles width.

Also I remove the flexbox property from siteDescription <article> and make it as black view.

Finally I do make Image and Description <div> to take 90% width and remove flexbox-order property.

Now let's see styles for Mobile device.

Image 10

Android (Galaxy s4 )

Image 11

Windows Phone (920)

Image 12

These styles are not much differ from styles that I used for layout that screen upto width of 500px.

Points of Interest

The most tricky part is how to handle flexbox. Try this link: FlexBox .

And try to find out Media Queries as well. Media Queries .

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Comments and Discussions

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

how to make a web page fixed size

how to make a web page fixed size

Back Home

Improve Your Digital Agency Revenue Now

Making a fixed width website mobile friendly.

Last Updated on May 22, 2020

css making fixed width mobile friendly

There will be a time when mobile overtakes desktop browsing. Since mobile has become so prominent in our everyday lives, there are times when we web designers need immediate results. If you’re one of those designers or programmers that just doesn’t have the time to convert a static website into a WordPress theme, one that’s mobile friendly, there is hope for you my friend. When it comes to viewing all of your content on mobile devices, you can accomplish this with a little CSS and HTML optimization.

That! Company provides captivating and effective web design services for agencies world-wide.  Learn More about our White Label Web Design   Services and how we can help you and your clients create or improve their web presence.  Get started today!

Globally, mobile devices account for more than half of the minutes spent online, according to comScore

Mobile friendly or responsive websites have the ability to configure the width of your website automatically, to fit the viewer’s device. Horizontal scroll bars are a no-no in responsive design. If you view your current website on a mobile device, and you see a scroll bar at the bottom of your phone or tablet, chances are your website (or elements of your site) isn’t mobile friendly. These horizontal scroll bars ruin the user’s experience and will most likely click the back button. People are so accustomed to scrolling vertically on their devices, so that when users find themselves having to scroll vertically as well as horizontally to view content, they become uncomfortable and leave the site.

It’s all-inclusive from this point going forward, design websites have CSS classes and ID’s for everything, and I mean everything.

From the header and menu div’s to the <p> tags in the footer. You’ll want to adjust the size of all these things based on screen width. Moving, sizing, and scaling are a lot easier when the element can be targeted via CSS.

CSS Media Queries are easier to use than you think.

That! Company White Label Services

The first time media queries were brought to my attention, I thought it was part of a programming language, and not a form of CSS. I was overcome by a sense of relief, when I found out what it truly was, and I’ve been using it ever since on ALL of my web projects.

@media only screen and (min-width: 100px) and (max-width: 699px) {

body { background-color : blue}

So the above code is simply saying that if the user’s screen is between 100px and 699px wide, then change the body’s background color to blue. This is where labeling every div and span in your site becomes crucial. Manipulating these elements for different screen widths become easier with proper tagging. list many mobile widths for us as a quick reference.

/* ———– Galaxy S5 ———– */

/* Portrait and Landscape */

@media screen

and (device-width: 360px)

and (device-height: 640px)

and (-webkit-device-pixel-ratio: 3) {

/*****YOUR CODE HERE*****/

/* ———– HTC One ———– */ /* Portrait and Landscape */

/* ———– iPhone 5 and 5S ———– */

@media only screen

and (min-device-width: 320px)

and (max-device-width: 568px)

and (-webkit-min-device-pixel-ratio: 2) {

/* ———– iPhone 6 ———– */

and (min-device-width: 375px)

and (max-device-width: 667px)

There is much more media query code for Galaxy, HTC, and Apple phones. Additionally, the widths for Ipad, Galaxy and Nexus tablet widths are listed. All you have to do is input this code to your site’s CSS file and fill in the blank CSS brackets with your own code! Done!

Your site’s responsive, but it still doesn’t feel quite right

web design and CSS

You may also deem certain elements as insignificant, ones that can found be on both desktop and mobile devices. . You can get rid of them using CSS:

#main-content .sidebar img { display : none}

These site adjustments have a tendency to make websites’ really long, compelling users to scroll a lot. This is where anchor text (for sighted users), or skip links (for screen readers) become your friend.

Anchor text is a clickable link that allows users to skip to a certain section of your web page, without having to scroll. It’s a handy method for mobile friendly sites. The code below is an example of anchor text linking.

<a href=”#skip”>Click here to skip to Main Content</a>

<a id=”skip”></a>Main content starts here

Skip Links are mainly used for screen readers and allow users with disabilities to bypass or skip over repetitive web content, like menu navigation, and get right to the information that interests them.

If skip links have a CSS rule of “display:none”, screen readers the link becomes “inaccessible”. So, a way around this is to position the links off screen, that way screen readers can still recognize your links, and allow them to skip through your newly mobile site.

.skip-link {

position: absolute !important;

top: -9999px !important;

left: -9999px !important;

So, that’s the quick and easy way to convert your fixed width website into a mobile friendly one. Also, don’t forget to set all your images to “width: 100%; height: auto.”  Any images, div’s or spans that have a set width in pixels, will create to the horizontal scroll bar on mobile devices, so remember to set them to either percentages, or different widths for the varying devices using media queries.

It can be a bit time consuming, but trust me, once you learn it, you’ll use it forever. You’ll use this method on every website you’ll ever do, because even the newest WordPress or Joomla responsive themes and templates require a little doctoring to get them to look the way you want them to. That is especially true, with the ever-changing market for mobile devices.

-Izzak Hale, Senior Graphic Designer


  1. The Average Web Page Size, or Memory Footprint, has Grown About 14% in 2014

    how to make a web page fixed size

  2. How to make web page size smaller

    how to make a web page fixed size

  3. How to Create a Simple Web Page With HTML (with Examples)

    how to make a web page fixed size

  4. How to Make Web Pages Load Faster?

    how to make a web page fixed size

  5. Simple Home Page In Html

    how to make a web page fixed size

  6. How to Make Your Web Pages Full Width

    how to make a web page fixed size


  1. playin ( data fixed ) Size legends simulater

  2. Manage Web Page, Change Contents

  3. Introduction To HTML|part(1)|computer|class6|ICSE

  4. 10 Limitations about GUIbuilder (Winstar SmartDisplay)

  5. How to make web page design using HTML #youtubeshorts #shortvideo #webpagedesign #webdesign

  6. Expand and Rewrite the Content on your Page


  1. How to Create a Fixed-Width Layout with CSS

    A "fixed-width" layout is one in which the layout of the page is contained within a wrapper that doesn't adjust its size when the width of the browser changes.

  2. How to keep website width fixed (irrespective of screen size)

    The key is the auto margin for left and right. This will horizontally align that 980px div in the center and keeping the width no matter what.

  3. How do you make a website a fixed width?

    To make something centreed: use margins. Do not use align:center; This is outdated. Apply margin:0px auto 0px auto to whatever element you want

  4. Fixed Width Design

    To do so, you have to declare a width property in your CSS code with some value in it. Whether it was 640, 800, or 1080 pixels, choosing one

  5. HTML vs Body: How to Set Width and Height for Full Page Size

    So What is the Fix? ... You may sleep better knowing it starts with a page width setting. This problem arises when any element - not just the HTML

  6. how do you fit a webpage size to fit any screen size

    just like you set width: auto; you can add the property max-width: 1000px; for example (you can have both property's) you can even add a min-width. (min-height

  7. CSS Layout

    Using max-width instead, in this situation, will improve the browser's handling of small windows. This is important when making a site usable on small devices:.

  8. CSS Height, Width and Max-width

    auto - This is default. · length - Defines the height/width in px, cm, etc. · % - Defines the height/width in percent of the containing block · initial - Sets the

  9. Adjusting your Websites to Fit all Types of Resolution Using HTML

    So lets take a look at a effective way of make a web site screen size adjustable by using some great things in HTML and CSS. Lets look at what

  10. Making A Fixed Width Website Mobile Friendly

    From the header and menu div's to the <p> tags in the footer. You'll want to adjust the size of all these things based on screen width. Moving