css

Why should I use a container div in HTML?

I am currently learning html/css, and have noticed a common technique is to place a generic container div in the root of the body tag: <html> <head> ... </head> <body> <div id="container"> ... </div> </body> </html> Is there a valid reason for doing this? Why can't the css just reference the body tag? ...

Images and a dynamic layout

I'm working on a website with a em-based layout (so it can stretch and compress gracefully when users increase or decrease font size). This site has a header that should be displayed across all pages. I have a "header" div in all pages, and the site-wide css file includes the code: #header { width: 50em; height: 6em; margi...

Firefox won't display an image!

This is very interesting to me... This image displays perfectly well in Safari, but not at all in Firefox! Here's the relevant code: <div id="ad"> <p>Advertisment</p> <img src="/ADS/fakead1.gif" /> </div> With CSS: #ad{color: #666;} #ad p{ font-size: .5em; text-align: center; padding: 0; margin: 0; } #ad img...

Why does this "width: auto" style work as an inline style in both browsers but break when moved to an external stylesheet only in IE?

I have an INPUT element that is defaulting to "width: 100%". This causes it to push other elements next to it down onto the next line. To fix this temporarily I added an inline style attribute on the element like this: <input style="width: auto" ...> which worked just fine. Now I'm going back to clean up the temporary fixes and I'm...

How do I hide an element when printing a web page?

My Problem is when i click print option On my webpage it is print the webpage but "The Print Link Lable Also Visible On webpage". So Please Give The Javascript Or HTML code To Hide The LInk Button When I Click The Print link Example: "Good Evening" Print (click Here To Print) I Want To...

Page Layout Issues

Please let me know why there is lot of white space below the page content and also why horizontal scroll bar is displayed. Attaching link to zip folder below. Unzip and open index.html. link text ...

CSS Positioning, want to make content's width fixed when window is resized.

I have a div with two nested divs inside, the (float:left) one is the menu bar, and the right (float:right) should display whatever content the page has, it works fine when the window is at a maximum, but when i resize it the content is collapsed until it can no longer has any space, at which it is forced to be displayed BELOW the left m...

What are best practices for preventing stale CSS and JavaScript

I'm researching this for a project and I'm wondering what other people are doing to prevent stale CSS and JavaScript files from being served with each new release. I don't want to append a timestamp or something similar which may prevent caching on every request. I'm working with the Spring 2.5 MVC framework and I'm already using the g...

Has anyone fixed the jQuery dialog button format in IE6 while using a Themeroller'ed theme?

I used Themeroller to generate an app theme and I am using jQuery and jQuery UI to create some modal dialog alerts. They work fine (and look great) on Firefox 2 and 3, but the buttons are shifted to the right on IE 6 and 7. It looks like it's being bitten by the IE margin bugs, but I wanted to see if there was an easy fix before digging ...

A mnemonic for the order of CSS margin and padding shorthand properties

I can never remember the order of the shorthand property for setting the margin or padding in one declaration. That is: margin-top: 2px; margin-bottom: 4px; margin-left: 3px; margin-right: 8px; may be written as margin: 2px 8px 4px 3px; Yes I understand that one can visualise the order by thinking of a clock, starting at midd...

CSS: Best way to center a DIV on a page vertically and horizontally?

Best way to center a div on a page both vertically and horizontally? I know that: margin-left: auto; margin-right: auto; Will center on the horizon but what is the best way to do it vertically too? Thanks ...

Working with DIV's & CSS

OK, if anyone could help me with this I'd be much appreciative. If you copy and paste the following and open up in IE or Firefox <div style="border: solid 1px navy; float: left;"> <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> <li>Item 4</li> <li>Item 5</li> </ul> </div> <div style="background-color: blue;"><p>...

.NET - How to build themes for big CSS files

I am in charge of providing a theme functionality for a site using a big CSS file (thousands of elements) I've just inherited. Basically we want to allow the user to be able to change the colors on the screen. Every CSS element, besides color definition also have lots of other attributes - size, font, float, etc... As well a specific co...

loading another movie in a css tag from a swf in the same page

how do i make abutton in a flash movie load amother flash movie in a css tag below in the same html page? ...

Combining CSS properties

I am trying to combine some of my CSS and it is kind of an easy questions but I am kind of having some trouble, i have this code: h2.post-title, h2.post-title a{ display:block; background-color:#000; padding:3px; color:#ffffff; text-decoration:none; text-transform:uppercase; font:lighter 130% Georgia, Arial; ...

How to detect when the height of your page changes?

I have a javascript heavy app which has widgets like autocomplete dropdowns and tabs and so forth. Sometimes when dropdowns appear and disappear, or when you switch between tabs, it changes the height of the document. This can cause annoyances if the scrollbar appears and disappears rapidly, because it shifts the page. I would like to de...

Why is Text flowing inside of an image with float: left; not wrapping?

I have the following HTML <div> <img id="image1" src="http://valleywag.com/assets/resources/2008/03/BlackGoogleLogo.jpg" alt="Why doesn't this float correcly?" style="border-width: 0px; float: left;" /> <div id="divText" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px;" cla...

Alternate background colors for list items

I have a list, and each item is linked, is there a way I can alternate the background colors for each item? <ul> <li><a href="link">Link 1</a></li> <li><a href="link">Link 2</a></li> <li><a href="link">Link 3</a></li> <li><a href="link">Link 4</a></li> <li><a href="link">Link 5</a></li> </ul> ...

IE6 invisible text in 7 lines HTML, is there a fix?

It took me forever to reduce the problem to this. I cannot express the amount of frustration I'm experiencing, and if I did, it would not be suitable for any website. Ever. Here is the HTML code that is causing me epic pain: <div style="padding: 5px; background: #EEE"> This text is invisible. Remove either padding or background to s...

html email with consideration for Blackberry.

Hi, I'm supporting a system which sends an automatic populated email alert. I've rendered the page using a combination of CSS and html. The alert is sent from a system called Salesforce. My problem is, I've never owned a blackberry, and don't have access to one for testing purposes, but I know the alert looks like crap on it. It seems t...