css

CSS Selector for selecting an element that comes BEFORE another element?

I'm working on a login page for my website and I want to bold the label that comes before the input box when the text box gains focus. Right now I have the following markup: <label for="username">Username:</label> <input type="textbox" id="username" /> <label for="password">Password:</label> <input type="textbox" id="password" /> I c...

When to use IMG vs. CSS background-image?

In what situations is it more appropriate to use an HTML IMG tag to display an image, as opposed to a CSS background-image, and vice-versa? Single-reason answers are welcome, but I'm hoping eventually to see a consolidated list of scenarios, rationales, etc. that can be used as a best-practice guide for making this kind of GUI design de...

HTML Display an Resized Image maintaning Ratio

I want to show an image from a URL and I want that image to have a given size but I want to maintain the ratio between height and width. ...

Multiple CSS Pseudo Classes

What is the proper CSS syntax is for applying multiple pseudo classes to a selector. I'd like to to insert "," after each item in a list except the last one. I am using the following css: ul.phone_numbers li:after { content: ","; } ul.phone_numbers li:last-child:after { content: ""; } This works fine on FF3, Chrome and Safa...

CSS Display an Image Resized and Cropped

I want to show an image from an URL with a certain width and height even if it has a diferent size ratio. So I want to resize (maintaning the ratio) and then cut the image to the size I want. I can resize with html img property and I can cut with background-image. How can I do both? Example: This image: "http://img1.jurko.net/wall/p...

How to build ImageButton Control Adapter (or more general, how to build a simple control adapter)?

Hi My inspiration for this question was my discovery of the very annoying default style (border-width: 0px;) on the ImageButton web control. The simple solution is to override it by adding your own style to the control e.g. Style="border-width: 2px;". How every, it would have been nice to just make a simple control adapter that would j...

Html elements positioned as relative, then moved -15px still take up same physical space

I've got a series of tabs on a page. The tabs are set to relative position. They are then moved 15px to the left. The resulting style looks like this: style="position:relative;left:-15px" (note that each tab's left is going to be -15 * tab number - so #2 will be -15, #3 is -30, etc.) This gives the tabs a nice overlapping feel, which i...

Trouble With CSS Floats

Hey All, I'm trying to create a dynamic popup window that is able to be re-sized. However, since I'm not able to use static widths, I'm running into issues with using floats and percentages for the widths. When I specify a percentage for the width of a floating div, it assumes I mean the 100% of the width of the containing div. What ...

How to grow a div by its content?

Hello, please, can someone explain to me, why the red div isn't expanding to the right? It stops where the screen ends. What do I have to do, to make it expand? One thing that works is to "display: table-cell" the red div but I was wondering if there's another way and why this happens...? <?xml version="1.0" encoding="UTF-8"?> <!DOCTYP...

HTML fragment links work with CSS positioning?

Last night I decided to add HTML fragment links in my computer listing page. However, no matter the pattern of linking, or whichever browser I use, those fragment links are simply not navigatable. http://icelava.net/mycomputers.aspx#SEPHIROTH http://icelava.net/mycomputers.aspx#DIABLO UPDATE on Answer: the links now flow correctly to ...

List of CSS features not supported by IE6

Hello, I just finished slicing and coding a very nice table-less css template for my website, all the time I was testing with IE7 and Chrome. Then I just had the brilliant idea of testing this template with IE6, I installed Windows XP on a Virtual PC and then I opened my website on IE6. It looks extremely bad! The format of my page lo...

Can I create a HTML table width a percentage height but pixel accurate row heights?

I need to create a table in a web page that has two rows. The table needs to fill the entire page so I have set the height and width of the table to 100% in the CSS stylesheet and the height of the html and body to 100% too. However, I need to top row of the table to be exactly 100 pixels in height and the second row to expand to fit th...

Free tools to speed up web development

As a little side project, I am starting to build a new website for a certain organization I am affiliated to, which current site is simply outdated. I am regularly a Java developer, and last time I really did some web development was back in the late 90s, when <p> was still more popular than <div> and Javascript was cutting-edge technol...

CSS - Separation of Color and Position

I'm just wondering what others do in this respect: Do you try to keep positional CSS (layout) separate from color/flavor CSS (color, background-color, background-images, font-size and family) ? Use two stylesheets? Combine two stylesheets server-side? Abstraction layer for the CSS? or you don't even try? I know sometimes after workin...

Linked Image Border Styles

I want to be able to link my image. Click on it. Go back to the page and see that it was visited. I want my visited images to have a different color border when I go back. My code: a:link img{border-color:#FFF; border-style:solid; border-width:1px;} a:hover img{border-color:#03F; border-style:solid; border-width:1px;} a:visited img, a:...

Ramifications of using a CSS stylesheet under the GPL?

Does referencing a CSS stylesheet with a GPL (or AGPL) license "infect" the server side of a web application? ...

How can I assign more than one "CssClass" to a control in asp.net

Can I assign more than one "CssClass" to a control in asp.net?How to do this? ...

CSS precedence rules

Hi, My understanding is that there are 3 types of stylesheet: Defined by the page author Defined by the user (i.e. a set of default styles defined by the user and installed into their browser) Default stylesheet defined by the browser According to this book if an element is not matched by a selector in any of these stylesheets, only...

CSS Styling the prompt tooltips in dojo

Does anyone know the name of the CSS classes responsible for styling the dojo promptMessages (or invalidMessages) tooltip associated with ValidationTextBoxes. Normally Firebug does a great job of revealing all the inner workings of CSS, but in this case the tooltip prompt disappears when I try to inspect it! I am intending to play with...

CSS: how can I force a long string (without any blank) to be wrapped in XUL and/or HTML

I have a long string (a DNA sequence). It does not contain any whitespace character. e.g.: ACTGATCGAGCTGAAGCGCAGTGCGATGCTTCGATGATGCTGACGATGCTACGATGCGAGCATCTACGATCAGTCGATGTAGCTAGTAGCATGTAGTGA what would be the css selector to force this text to be wrapped in an html:textarea or in a xul:textbox Thanks. ...