Is it possible to set border width in percents or for example do something like this: 100px-1% in CSS ?

Recommended Answers

All 2 Replies

css3 has calculated values
eg #mainContent { width: calc(100% - 20px) } newest browsers support some elements of css3
not sure which browsers support this part of css3
not sure if unsupported browsers degrade gracefully, or fall over and die,
so it may not be a useable (yet) feature

css2.1, more suppported, you can(may) style an element more readily by styling the containing element
may not help for a border specifically

browsers don't fully support css2.1yet
ie9 is due to support css3
Mozilla is due to release ff in 2011 with full css3
opera and ff have <selector>-o <selector>-moz support now for some css3

Just nest two box objects, each with one of those values. Put the % one on the outside. Make sure the padding on the outside one and the margin of the inside one are both set to 0.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.