Video: Checking for browser compatibility

One of the biggest headaches you'll run into when designing web pages is the dreaded browser compatibility problems with your CSS. Your styles might look great in the latest version of Opera, but IE 7 might render your floats totally wrong. Keeping track of and knowing how to fix these compatibility errors is almost a full-time job in and of itself. That's why I'm a pretty big fan of the browser compatibility check in Dreamweaver. When you run the browser compatibility check on your page or pages, Dreamweaver checks your site structure and your CSS to see if any browser compatibility issues are going to come up.

In Dreamweaver CS5 Essential Training, Adobe Certified Instructor James Williamson explores the tools and techniques of Dreamweaver CS5, Adobe's web design and development software. This course covers both the ins and outs of Dreamweaver, as well as recommended best practices for crafting new web sites and files, the fundamentals of HTML and CSS, and how to ensure clean and accessible code. The course also includes how to use tools in Dreamweaver to create and style web pages, manage multiple sites, and add user interactivity with widgets and scripting. Exercise files are included with the course.

Checking for browser compatibility

One of the biggest headaches you'll run into when designing web pages is thedreaded browser compatibility problems with your CSS.Your styles might look great in the latest version of Opera, but IE 7 mightrender your floats totally wrong.Keeping track of and knowing how to fix these compatibility errors is almost afull-time job in and of itself.That's why I'm a pretty big fan of the browser compatibility check in Dreamweaver.When you run the browser compatibility check on your page or pages, Dreamweaverchecks your site structure and your CSS to see if any browser compatibilityissues are going to come up.

Dreamweaver will even offer you advice on how to fix them.Even better, you can target specific browsers, so that you can limit the numberof errors that it's checking to just test the browsers that you're targeting for your site.So I have the Index file open and I'm going to check out running a browsercheck on this page.There are couple of different places that you can do this, but one of theeasiest is just to come up to your document toolbar and right here we have CheckBrowser Compatibility.Now, I'm going to grab that pull- down menu, and I want to go to mySettings right here.When I do that, notice that I can choose which browser I want to check againstand the earliest version that I want to check for.

So with Internet Explorer, maybe I really don't care what's going on with the5.0 versions, and truth to be told, I really don't. With Firefox, maybe you'regoing to check from versions 2.0 and up.For maybe Netscape, well, I am not going to check at all.Sorry, Netscape, I had to do it.For Opera, maybe you're going to check version 8 and above, and for Safari,maybe you're going to check 2 and above. All right!So I'm going to go ahead and click OK, and as soon as you do that, it's going torun a browser compatibility check whether you wanted to or not.So when you set those settings, just be prepared for this panel to open up.You'll notice that the Browser Compatibility panel is docked with the remainderof your Results panels.

You could also come to this panel directly and run the check from here.you don't have to do it from the document toolbar.Now, you're going to see a list of any errors that it found right over hereon the left-hand side.On the right-hand side, it's going to give you a summary of that error.Now you might find something cryptic like this, Found 1 errors in main.css, butit doesn't tell me what that error is.Well that's because it found the error in an external file.main.css is a totally separate file, but you know what, that's where all my CSS is.

So I want to go find out what the problem is.I'm going to switch over up here in my related files to main.css, and I'm justgoing to run a browser compatibility check on this page as well.I can see that it has an unsupported value called Transparent and that's on line 384.So again, that's kind of nice.It shows you exactly where that is.If I scroll down to line 384, I can see that I've got the tourBadge and I'msetting the color for that to transparent.Now you'll notice that's really only affecting a lot of the older browsers,although Internet Explorer 7 and 8 apparently don't support that value as well.

Well what we have going on in that particular element is a transparent PNG file.So really that rule is just covering our bases anyways.So what I'm going to do is so that I don't have to keep dealing with thisparticular issue. I'm going to right-click this and I'm going to tellDreamweaver from hence on to ignore that particular issue.So if you're running up against a bug that is showing up all the time, but youknow isn't going to negatively affect your page, you can have Dreamweaver ignore it so that you don't have to constantly see that.I'm going to go back to Index, click the Source Code, and I'm going to run thatbrowser compatibility check again. Okay, cool!We're not seeing the external error anymore, but we are seeing a couple of other errors.

Well, one of the problems here is Unscrollable Content Bug and Z-Index Bug.Now, what is up with that?Well again if you select the error, you'll get a summary of that error out tothe right and it will tell you which browsers it's going to affect and what thelikelihood is that, that error is going to cause you problems.In this case, Internet Explorer 6.0, it's very possible that this UnscrollableContent Bug is going to come up to bite us.Same thing for the Z-Index Bug.It's going to affect Internet Explorer 6.0 and 7.0 and the likelihood is very likely.Now, notice that both of these are line 11 and 12, so they're related.

If I take a closer look at my Code View, I can see that those two div tagsactually have that green underline under them.If I hover it, Dreamweaver is letting me know which of those two errors isaffecting those elements. Okay.So really what the problem is, is I think the header has a Z-Index property onit and that helps objects stack one on top of the other.Truth to be told, the header is the only positioned element on that part of the page, so I don't really need the Z-Index for that.So what I'm going to do is come over here and click in my header graphic, holddown my Alt key on the PC, Command+ Option on the Mac, and I'm just going to findthe offending rule, and in this case there it is right there, #header and I cansee that it has a Z-Index of 10.

I'm going to click on that.It's going to take me into Code View, and let me minimize that a little bit justto get it out of the way, and I'm just going to highlight the Z-Index rating,and I'm going to get rid of that.As a matter of fact, the main header above it, its position is relative, butthe header, which is inside this one, really should be positioned relative to the wrapper.So I'm going to get rid of that as well.That rule really isn't doing me any good.Now, I'll do a Save All there, and I will come back to my browser compatibilitycheck, click on my Source Code and run it again.Now, you can see those underlines go away, and that problem has been resolved. Great!There is one more problem and this is a Float Drop Problem.

Now, if the summary over here isn't enough information for you, you'll noticethat there's a little blue link that says View Solution to the Float DropProblem on Adobe.com.If you click on that, it's going to take you to Adobe's web site to somethingcalled the CSS Advisor.Adobe's CSS Advisor is a repository of information for different browser bugsand it's a really good place to go to learn a little bit more about making yourCSS cross browser compatible.There's articles, forums, and specific bug information like we're seeing here.

Float Drop - floated elements drop below their expected position.We can see a problem. There is some solutions for them, detail descriptions, andeven code examples to kind of help you work your way through those issues.So this is a really nice resource.There are even links here to other articles online that show you differenttutorials and tips in dealing with some of these different problems.Now in reading up on this problem a little bit, it's typically triggered bylonger unbroken characters that just can't fit within that width anymore.

So if I close my browser and go back into Design View and kind of go down intomy footer, I see that I don't really have any text that's in any kind of dangerof butting up against the edge of these columns.So I think for this one I'm safe.And really it's only going to affect Internet Explorer 6.0 and 7.0, so if I weregoing to do a fix for that, I'd probably pass-in a conditional statement that'sonly going to target those specific browsers.So I think we're okay.Now, one more thing before we move on, earlier we told Dreamweaver to ignore theTransparent value on the Color property.

Those types of exceptions are stored in an XML file named appropriatelyenough Exceptions.xml.From time to time you might want to turn those back on or even go in there andsee which problems you've added to the exception list.It's really easy to do.You can simply right-click any issue that comes up, and you can say EditIgnored Issues List.That's going to open up this Exceptions.xml file.There are some nice instructions in the form of comments here that tell youhow to manually add code to instruct Dreamweaver to ignore certain values or properties.

You can see for example it says cssvalue property="color".It's going to ignore any problems with that.If you want to remove that it's easy enough. You can just delete it from thefile, save the file and the next time you run your browser compatibility check,Dreamweaver will show those errors again.So there's an amazing amount of flexibility associated with the browsercompatibility check.Now, this check is not going to pick up on every error or browser rendering issue.It also might not give you exactly the information you need to fix theproblems that it finds.

It does, however, offer you the invaluable service of catching the majority ofthose issues and it's a great way of learning about some of those browser issuesthat you might otherwise have not known about.

Q: After creating a website following the instructions in the course, the header background graphic appears correctly in all browsers except Internet Explorer 6 and Internet Explorer 7. The graphic works properly in IE 8. What can be done to make the graphics appear in IE 6 and IE 7?

A: To make the header background graphic appear, wrap the header div tag in another div tag and give it an ID like “mainHeader.” The problem stems from a bug in Internet Explorer that prevents the browser from dealing with absolutely positioned elements that are right next to relatively positioned elements. Following the steps above should solve the problem.

Q: In the tutorial, the author links the Tool Tip to the word "More" at the bottom of the thumbnail photo field. I can't figure out how to place the <a> "More" on the thumbnail photo field.

A: In the example, there is a paragraph that wraps an <img> tag and the word "More," which is surrounded by an anchor tag (<a>). The author uses CSS to make sure the parent div tag of the thumbs floats to the left, and is only wide enough for the image. This causes the link text to break down onto another line. Then, the instructor uses CSS to align the link text to the right of the <img>. The link itself is a void JavaScript function, ( javascript();). This gives you a "dummy" link without returning you to the top of the page as the "#" dummy link tends to do.If you were manually typing the text in, you could select the image, hit the right arrow button, and begin typing. The text should then appear on screen.

Q: In this movie, you are making changes to the HTML in order to customize the text layout on your page (i.e. h1, h2, and h3 tags as well as strong and em tags). I'm wondering why you are not using CSS to do this (i.e. font-size, font-weight). Do you typically use one method, or is it customary to do use both in a layout, and if so, what guidelines would you suggest to determine which to use when?

A: We modify the page's structure through the use of h1, h2, and other heading tags. So when we are choosing heading levels, we're not concerning ourselves with typography; we're establishing page structure. A heading is chosen to denote the level of importance for the heading, not typography.CSS should always be used for presentation, not HTML.

Q: In the “Understanding ID selectors” movie, the author states that only one ID tag can be used per page, but then he adds two ID tags. Can you please clarify this for me?

A: You can use as many IDs per page as you wish. They just must all use a unique name. Therefore if you assign an element the ID of "header" no other element on THAT page may use the same ID.

Q: I noticed that in this course, the instructor uses this code on his CSS external sheet: @charset "UTF-8"; I was under the impression that this code wasn't necessary. The W3.org site is unclear on the matter. Is it necessary? Is it a best practice? Is it an older form of CSS?

A: The characterset attribute is added automatically by Dreamweaver, and there’s no practical reason to remove it. While it's not needed (the HTML page should indicate which encoding to use for the page) it is helpful if the CSS file is ever imported or used on a page where the characterset isn't specified. Think of it as a safety net for characterset encoding. Not necessary, but not harmful either.

Q: I need to add captions below images that I insert in pages of text. I played all the lessons in Chapter 5 (Adding Text and Structure) but none dealt with captions. I hope the author has an answer or can refer me to a source.

A: In HTML 4 and XHTML 1 (which is what Dreamweaver CS5 uses by default), there wasn't really a way to add captions below your photos. Most web authors would "fake" captions by having paragraphs of text below their images and using CSS to position and style the captions in the desired manner. Many would use a class such as .imgCaption to control the styling. To do this you would essentially position the text underneath the image through CSS (often by grouping the image and the paragraph in a div tag) and italicizing the text.

However in HTML5, there are new elements that allow us to associate images and their captions, the figure and figcaption element. Our author James Williamson just finished a course on HTML5: Syntax, Structure, and Semantics which details how to use it.

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.

Already a member ?

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

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

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:

new course releases

newsletter

general communications

special notices

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:

new course releases

newsletter

general communications

special notices

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