开发者

CSS3 border-image

开发者 https://www.devze.com 2023-01-23 11:16 出处:网络
Do I need some special DOCTYPE when I want to use CSS3 ? I have div w开发者_如何学Pythonith dashed border and I want to set border-image (only can with CSS3), but when I set border-image:url(.., nothi

Do I need some special DOCTYPE when I want to use CSS3 ? I have div w开发者_如何学Pythonith dashed border and I want to set border-image (only can with CSS3), but when I set border-image:url(.., nothing happens.


Some browsers may only support CSS 3 features in Standards Mode, but a standards mode triggering Doctype should be considered business as usual and not "special".

Keep in mind that CSS 3 is a collection of specifications that have not yet reached recommendation stage. They are very new and browser support is far from universal (and isn't a binary state of 'supports CSS 3 or not' — the current versions of all the major web browsers support some of CSS 3 (for different values of 'some'). Your problem could simply be that you aren't using a browser that supports border-image.


border-image currently works in Safari and Firefox 3.1 (Alpha). The syntax to use it is:

border-image: url(border.png) 27 27 27 27 round round;

See demonstration page


CSS3 is not available on all browsers at this time. Right now, only Chrome, Opera, and Safari support it. CSS3 commands will not work on IE; you'll have to find other work-arounds or wait until browsers catch up with the standards.


Most likely the border-image did not show up, because you didn't use the correct prefixes. Right now, just "border-image" is not supported by major browsers, hence you need to add the prefix for the browser.

E.g.

-webkit-border-image
-moz-border-image
-o-border-image
  • -webkit - for WebKit-based browsers such as Google Chrome and Safari
  • -moz - for Firefox
  • -o - for Opera


You do not need a specific DOCTYPE, but border-image is only supported in some browsers. You can also use:

-webkit-border-image
-moz-border-image
-khtml-border-image
-o-border-image

to broaden the range of support for browsers. CSS3 has not been implemented as a standard across all current browsers, so using specific CSS tags is the best way to go for now.


Support is very limited and inconsistent across the browsers that do support it. Check Quirksmode (bottom of the table) to see the bad news http://www.quirksmode.org/css/background.html

0

精彩评论

暂无评论...
验证码 换一张
取 消