Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Creating a layout that fits all browsers

From: Creating a First Web Site with Dreamweaver CS6

Video: Creating a layout that fits all browsers

A recent movement that's going on in the web today's what is called a responsive design, and that's having your content respond based on the browser window size as well as even the device you view your content on. So say for instance, if I scaled down this browser window, you can see that everything is static. So if you're viewing this on a smaller monitor, the user would actually have to scroll, so that's not very usable. What if they're on an iPad that's more like this? Well, again, you have the same issue where they're going to have to scroll, and it gets even worse as we go down to even a mobile device.

Creating a layout that fits all browsers

A recent movement that's going on in the web today's what is called a responsive design, and that's having your content respond based on the browser window size as well as even the device you view your content on. So say for instance, if I scaled down this browser window, you can see that everything is static. So if you're viewing this on a smaller monitor, the user would actually have to scroll, so that's not very usable. What if they're on an iPad that's more like this? Well, again, you have the same issue where they're going to have to scroll, and it gets even worse as we go down to even a mobile device.

So we need to make sure our content is flexible and responds based on the browser window size. So that's what I'm going to do. I'm going to start off first with this Nav bar. With that Nav bar selected, notice right down here, all of these sizes and positions are fixed. So they're fixed sizes and positions. And what I can do is I can say, hey, you know what? From the left side, let's make it 5% of that total width will be 5%. What about the width of the bar entirely? Well, let's make that 90%.

So now we have 5%, 90% and then another 5% there. So I just made it more flexible. In fact, if I save this and even view it in a browser and resize this window, you can see how that reacts. That's exactly what I want. In fact, going from there I want this section to move accordingly. Maybe I wanted to always be 60% of the width of the browser window and still give it that 5% padding on the side.

To keep in mind it's actually floating on the right side so this will be a little bit different. Going in here to this item right here, I can select. It happens to be this div and what I can do for this tag, I can change this say for instance, from the left-hand side. Well, I don't want it to be fixed at 425. So I'm just going to delete at entirely, just like that. Well, that doesn't seem quite right, but we'll get there. The width, well, we can make it 60% just like that.

Well, okay that's good. But how do I make it float on the right-hand side? Well, I need to go beyond this Properties panel. Again, it's for this section tag. I can double-click on it to edit the CSS Rule definition, and I can go down in here to the Box category, and I can say, hey, you know what? Go ahead and float to the right-hand side. Float it on the right. In fact, for the Positioning, don't make the Position absolute, make it relative.

That's going to be the Position. Clicking Apply, it floats it over there. Also, right down here from the right- hand side, let's give it that 5% padding. Clicking Apply, we can move that in. That will line up. With all of that in place I can save this and preview it in a browser. There is my section, and it expands and contracts accordingly. So far so good.

I'm going to do two more things really fast, and that's these elements. I always want these elements to be flush with this nav. So closing that I will come in here for this particular item. Again from the left side don't make that fixed, make it always 5%. For this element it happens to be the header. Don't make it 100 pixels from the side. Make that 5% as well of the total browser width, saving that, previewing it in browser, and now we have that nice and flexible. It's all locked down, and now we can go from large to small.

But what's also happening here--and this is really the last thing I'm going to visually--is I don't want this background to get cut out. I really like it. I want the background to scale down. I wanted to still cover, but I want it to make sure it fills that browser window. So I'm going to have the background scale, closing that. Now I got to find my background first. So right in here as I select this body tag, you're going to see it right down here, and I can double-click on it, and I can go in to the Background right here, and you will start to look in here, and you'll notice, well, there is this Background-repeat, Background-attachment. Well, I can change that to fixed.

So it's always going to stay in a fixed position so the content will scroll. So I like that, but that background cover is not in here. So I'll just click OK. What I can do is I can Add a Property, because there is actually even more properties available in here. In fact, to look at all these various CSS properties I can add to this element. So I'll scroll up. I want to locate the background. Quite a few in here, quite a few properties, and background size is what I want to select.

So selecting that. I am going to check out my options for it to make it automatic. Contain which means it will always be contained. You will see the entire image that I wanted to cover, regardless of the size or aspect ratio of the browser. So selecting cover. I think that will do it, and I will save this page. Here's the fun part. It's previewing it in a browser. I see that nice full image. Well, what if you're a on a small browser window, or on a small monitor? That's looks good. It scales.

So this is what I mean when I say responsive design. Having this flexible layout, you can see how wonderful this works and how beneficial this will be for your end user, making sure they can see all of the content.

Show transcript

This video is part of

Image for Creating a First Web Site with Dreamweaver CS6
Creating a First Web Site with Dreamweaver CS6

30 video lessons · 40190 viewers

Paul Trani
Author

 

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Creating a First Web Site with Dreamweaver CS6.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.