Webkit gradient
Author: m | 2025-04-24
Here is how to add gradient crossbrowser: background: -o-linear-gradient(); background: -webkit-gradient(); / Older webkit syntax / background: -webkit-linear-gradient(); background: -ms-linear-gradient(); Example on webkit: background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(), to()); Here is how to add gradient crossbrowser: background: -o-linear-gradient(); background: -webkit-gradient(); / Older webkit syntax / background: -webkit-linear-gradient(); background: -ms-linear-gradient(); Example on webkit: background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(), to());
gradient background not working in Chrome with -webkit-gradient
Div { background-image: linear-gradient (trái, # 999999 0%, #ffffff 100%; } Tiện ích mở rộng trình duyệt cho Gradient tuyến tính CSS3 Để làm cho gradient của bạn hoạt động trên nhiều trình duyệt, bạn cần phải sử dụng các tiện ích mở rộng của trình duyệt cho hầu hết các trình duyệt và bộ lọc cho Internet Explorer 9 trở xuống (thực ra là 2 bộ lọc). Tất cả những yếu tố này đều có cùng các yếu tố để xác định độ dốc của bạn (ngoại trừ việc bạn chỉ có thể xác định gradient 2 màu trong IE). Bộ lọc và phần mở rộng của Microsoft —Internet Explorer là thách thức lớn nhất để hỗ trợ, bởi vì bạn cần ba dòng khác nhau để hỗ trợ các phiên bản trình duyệt khác nhau. Để có được gradient màu xám sang trắng bạn sẽ viết: / * IE 5,5–7 * / bộ lọc: progid: DXImageTransform.Microsoft.gradient (startColorstr = '# 999999', endColorstr = '# ffffff', GradientType = 1); / * IE 8–9 * / -ms-filter: "progid: DXImageTransform.Microsoft.gradient (startColorstr = '# 999999', endColorstr = '# ffffff', GradientType = 1)"; / * IE 10 * / -ms-linear-gradient (trái, # 999999 0%, #ffffff 100%); Tiện ích mở rộng Mozilla —Ứng dụng -moz- hoạt động giống như thuộc tính CSS3, chỉ với phần mở rộng -moz-. Để có được gradient trên cho Firefox, hãy viết: -moz-linear-gradient (trái, # 999999 0%, #ffffff 100%); Tiện ích mở rộng của Opera —Mở rộng -o- thêm gradient vào Opera 11.1+. Để có được gradient ở trên, hãy viết: gradient -o-tuyến tính (trái, # 999999 0%, #ffffff 100%); Phần mở rộng Webkit —Mở rộng -webkit- hoạt động rất giống với thuộc tính CSS3. Để xác định gradient ở trên cho Safari 5.1+ hoặc Chrome 10+ bạn viết: -webkit-linear-gradient (trái, # 999999 0%, #ffffff 100%); Ngoài ra còn có một phiên bản cũ hơn của phần mở rộng Webkit hoạt động với Chrome 2+ và Safari 4+. Trong đó, bạn xác định loại gradient là một giá trị, thay vì trong tên thuộc tính. Để có được gradient xám trắng với phần mở rộng này, hãy viết: -webkit-gradient (tuyến tính, trái trên cùng, bên phải trên cùng, màu sắc dừng lại (0%, # 999999), màu sắc-stop (100%, # ffffff)); Mã CSS Gradient tuyến tính CSS3 đầy đủ Đối với hỗ trợ đa trình duyệt để có được màu xám đến trắng ở trên, trước tiên bạn nên bao gồm một màu dự phòng cho các trình duyệt không hỗ trợ gradient và mục cuối cùng phải là kiểu CSS3 cho các trình duyệt hoàn toàn tuân thủ. Vì vậy, bạn viết: nền: # 999999; nền: -moz-linear-gradient (trái, # 999999 Here is how to add gradient crossbrowser: background: -o-linear-gradient(); background: -webkit-gradient(); / Older webkit syntax / background: -webkit-linear-gradient(); background: -ms-linear-gradient(); Example on webkit: background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(), to()); Here is how to add gradient crossbrowser: background: -o-linear-gradient(); background: -webkit-gradient(); / Older webkit syntax / background: -webkit-linear-gradient(); background: -ms-linear-gradient(); Example on webkit: background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(), to()); Bên trái: nền: ## 901A1C; background-image: -moz-linear-gradient (phía trên bên phải, # 901A1C 0%, # FFFFFF 100%); background-image: -webkit-gradient (tuyến tính, đỉnh phải, đáy trái, màu dừng (0, # 901A1C), màu dừng (1, #FFFFFF)); nền: -webkit-linear-gradient (phải trên cùng, # 901A1C 0%, #ffffff 100%); background: -o-linear-gradient (phía trên bên phải, # 901A1C 0%, #ffffff 100%); nền: -ms-linear-gradient (phía trên bên phải, # 901A1C 0%, #ffffff 100%); nền: linear-gradient (phải trên cùng, # 901A1C 0%, #ffffff 100%); Bạn có thể nhận thấy rằng không có bộ lọc IE nào trong ví dụ này. Đó là bởi vì IE chỉ cho phép hai loại bộ lọc: từ trên xuống dưới (mặc định) và từ trái sang phải (với công tắc GradientType = 1). Xem gradient tuyến tính chéo này trong hành động chỉ sử dụng CSS. 03 trên 04 Dừng màu Một gradient với ba điểm dừng màu. J Kyrnin Với gradient tuyến tính CSS3, bạn có thể thêm nhiều màu sắc cho gradient của mình để tạo ra hiệu ứng thậm chí còn đẹp hơn. Để thêm các màu này, bạn thêm các màu bổ sung vào cuối thuộc tính của mình, được phân tách bằng dấu phẩy. Bạn nên bao gồm nơi trên dòng màu sắc nên bắt đầu hoặc kết thúc là tốt. Bộ lọc Internet Explorer chỉ hỗ trợ hai điểm dừng màu, vì vậy khi bạn tạo gradient này, bạn chỉ nên bao gồm màu đầu tiên và thứ hai mà bạn muốn hiển thị. Đây là CSS cho gradient 3 màu ở trên: nền: #ffffff; nền: -moz-linear-gradient (bên trái, #ffffff 0%, # 901A1C 51%, #ffffff 100%); background: -webkit-gradient (tuyến tính, đầu trái, phải trên cùng, màu dừng (0%, # ffffff), màu dừng (51%, # 901A1C), dừng màu (100%, # ffffff)); nền: -webkit-linear-gradient (bên trái, #ffffff 0%, # 901A1C 51%, # ffffff 100%); background: -o-linear-gradient (bên trái, #ffffff 0%, # 901A1C 51%, # ffffff 100%); nền: -ms-linear-gradient (bên trái, #ffffff 0%, # 901A1C 51%, # ffffff 100%); bộ lọc: progid: DXImageTransform.Microsoft.gradient (startColorstr = '# ffffff', endColorstr = '# ffffff', GradientType = 1); background: gradient tuyến tính (trái, #ffffff 0%, # 901A1C 51%, # ffffff 100%); Xem gradient tuyến tính này với ba điểm dừng màu trong hành động chỉ bằng CSS. 04/04 Làm cho tòa nhà Gradients dễ dàng hơn Trình tạo Gradient CSS cuối cùng. ảnh chụp màn hình bởi J Kyrnin lịch sự ColorZilla Có hai trang web tôi khuyên bạn nên giúp bạn xây dựng gradient, mỗi trang web đều có những lợi ích và hạn chế đối với họ, tôi chưa tìm thấy trình tạo gradient làm mọi thứ. Trình tạo Gradient CSS cuối cùng Trình tạo gradient này rất phổ biến vìComments
Div { background-image: linear-gradient (trái, # 999999 0%, #ffffff 100%; } Tiện ích mở rộng trình duyệt cho Gradient tuyến tính CSS3 Để làm cho gradient của bạn hoạt động trên nhiều trình duyệt, bạn cần phải sử dụng các tiện ích mở rộng của trình duyệt cho hầu hết các trình duyệt và bộ lọc cho Internet Explorer 9 trở xuống (thực ra là 2 bộ lọc). Tất cả những yếu tố này đều có cùng các yếu tố để xác định độ dốc của bạn (ngoại trừ việc bạn chỉ có thể xác định gradient 2 màu trong IE). Bộ lọc và phần mở rộng của Microsoft —Internet Explorer là thách thức lớn nhất để hỗ trợ, bởi vì bạn cần ba dòng khác nhau để hỗ trợ các phiên bản trình duyệt khác nhau. Để có được gradient màu xám sang trắng bạn sẽ viết: / * IE 5,5–7 * / bộ lọc: progid: DXImageTransform.Microsoft.gradient (startColorstr = '# 999999', endColorstr = '# ffffff', GradientType = 1); / * IE 8–9 * / -ms-filter: "progid: DXImageTransform.Microsoft.gradient (startColorstr = '# 999999', endColorstr = '# ffffff', GradientType = 1)"; / * IE 10 * / -ms-linear-gradient (trái, # 999999 0%, #ffffff 100%); Tiện ích mở rộng Mozilla —Ứng dụng -moz- hoạt động giống như thuộc tính CSS3, chỉ với phần mở rộng -moz-. Để có được gradient trên cho Firefox, hãy viết: -moz-linear-gradient (trái, # 999999 0%, #ffffff 100%); Tiện ích mở rộng của Opera —Mở rộng -o- thêm gradient vào Opera 11.1+. Để có được gradient ở trên, hãy viết: gradient -o-tuyến tính (trái, # 999999 0%, #ffffff 100%); Phần mở rộng Webkit —Mở rộng -webkit- hoạt động rất giống với thuộc tính CSS3. Để xác định gradient ở trên cho Safari 5.1+ hoặc Chrome 10+ bạn viết: -webkit-linear-gradient (trái, # 999999 0%, #ffffff 100%); Ngoài ra còn có một phiên bản cũ hơn của phần mở rộng Webkit hoạt động với Chrome 2+ và Safari 4+. Trong đó, bạn xác định loại gradient là một giá trị, thay vì trong tên thuộc tính. Để có được gradient xám trắng với phần mở rộng này, hãy viết: -webkit-gradient (tuyến tính, trái trên cùng, bên phải trên cùng, màu sắc dừng lại (0%, # 999999), màu sắc-stop (100%, # ffffff)); Mã CSS Gradient tuyến tính CSS3 đầy đủ Đối với hỗ trợ đa trình duyệt để có được màu xám đến trắng ở trên, trước tiên bạn nên bao gồm một màu dự phòng cho các trình duyệt không hỗ trợ gradient và mục cuối cùng phải là kiểu CSS3 cho các trình duyệt hoàn toàn tuân thủ. Vì vậy, bạn viết: nền: # 999999; nền: -moz-linear-gradient (trái, # 999999
2025-03-27Bên trái: nền: ## 901A1C; background-image: -moz-linear-gradient (phía trên bên phải, # 901A1C 0%, # FFFFFF 100%); background-image: -webkit-gradient (tuyến tính, đỉnh phải, đáy trái, màu dừng (0, # 901A1C), màu dừng (1, #FFFFFF)); nền: -webkit-linear-gradient (phải trên cùng, # 901A1C 0%, #ffffff 100%); background: -o-linear-gradient (phía trên bên phải, # 901A1C 0%, #ffffff 100%); nền: -ms-linear-gradient (phía trên bên phải, # 901A1C 0%, #ffffff 100%); nền: linear-gradient (phải trên cùng, # 901A1C 0%, #ffffff 100%); Bạn có thể nhận thấy rằng không có bộ lọc IE nào trong ví dụ này. Đó là bởi vì IE chỉ cho phép hai loại bộ lọc: từ trên xuống dưới (mặc định) và từ trái sang phải (với công tắc GradientType = 1). Xem gradient tuyến tính chéo này trong hành động chỉ sử dụng CSS. 03 trên 04 Dừng màu Một gradient với ba điểm dừng màu. J Kyrnin Với gradient tuyến tính CSS3, bạn có thể thêm nhiều màu sắc cho gradient của mình để tạo ra hiệu ứng thậm chí còn đẹp hơn. Để thêm các màu này, bạn thêm các màu bổ sung vào cuối thuộc tính của mình, được phân tách bằng dấu phẩy. Bạn nên bao gồm nơi trên dòng màu sắc nên bắt đầu hoặc kết thúc là tốt. Bộ lọc Internet Explorer chỉ hỗ trợ hai điểm dừng màu, vì vậy khi bạn tạo gradient này, bạn chỉ nên bao gồm màu đầu tiên và thứ hai mà bạn muốn hiển thị. Đây là CSS cho gradient 3 màu ở trên: nền: #ffffff; nền: -moz-linear-gradient (bên trái, #ffffff 0%, # 901A1C 51%, #ffffff 100%); background: -webkit-gradient (tuyến tính, đầu trái, phải trên cùng, màu dừng (0%, # ffffff), màu dừng (51%, # 901A1C), dừng màu (100%, # ffffff)); nền: -webkit-linear-gradient (bên trái, #ffffff 0%, # 901A1C 51%, # ffffff 100%); background: -o-linear-gradient (bên trái, #ffffff 0%, # 901A1C 51%, # ffffff 100%); nền: -ms-linear-gradient (bên trái, #ffffff 0%, # 901A1C 51%, # ffffff 100%); bộ lọc: progid: DXImageTransform.Microsoft.gradient (startColorstr = '# ffffff', endColorstr = '# ffffff', GradientType = 1); background: gradient tuyến tính (trái, #ffffff 0%, # 901A1C 51%, # ffffff 100%); Xem gradient tuyến tính này với ba điểm dừng màu trong hành động chỉ bằng CSS. 04/04 Làm cho tòa nhà Gradients dễ dàng hơn Trình tạo Gradient CSS cuối cùng. ảnh chụp màn hình bởi J Kyrnin lịch sự ColorZilla Có hai trang web tôi khuyên bạn nên giúp bạn xây dựng gradient, mỗi trang web đều có những lợi ích và hạn chế đối với họ, tôi chưa tìm thấy trình tạo gradient làm mọi thứ. Trình tạo Gradient CSS cuối cùng Trình tạo gradient này rất phổ biến vì
2025-04-16Color=> #37cdff> rgba(color, 0.5)=> rgba(55,205,255,0.5)$ stylus -i> color = white=> #fff> color - rgb(200,50,0)=> #37cdff> color=> #fff> color -= rgb(200,50,0)=> #37cdff> color=> #37cdff> rgba(color, 0.5)=> rgba(55,205,255,0.5)Resolving relative urls inside imports By default Stylus don't resolve the urls in imported .styl files, so if you'd happen to have a foo.styl with @import "bar/bar.styl" which would have url("baz.png"), it would be url("baz.png") too in a resulting CSS.But you can alter this behavior by using --resolve-url (or just -r) option to get url("bar/baz.png") in your resulting CSS.List dependencies You can use --deps (or just -D) flag to get a list of dependencies of the compiled file.For example, suppose we have test.styl:@import 'foo'@import 'bar'@import 'foo'@import 'bar'And inside foo.styl:@import 'baz'@import 'baz'Running:$ stylus --deps test.styl$ stylus --deps test.stylWill give us list of the imports paths:foo.stylbaz.stylbar.stylfoo.stylbaz.stylbar.stylNote that currently this does not works for dynamically generated paths.Utilizing Plugins For this example we'll use the nib Stylus plugin to illustrate its CLI usage.Suppose we have the following Stylus, which imports nib to use its linear-gradient() function.@import 'nib'body background: linear-gradient(20px top, white, black)@import 'nib'body background: linear-gradient(20px top, white, black)Our first attempt to render using stylus(1) via stdio might look like this:$ stylus test.styl$ stylus test.stylWhich would yield the following error (because Stylus doesn't know where to find nib).Error: stdin:3 1| 2|> 3| @import 'nib' 4| 5| body 6| background: linear-gradient(20px top, white, black)Error: stdin:3 1| 2|> 3| @import 'nib' 4| 5| body 6| background: linear-gradient(20px top, white, black)For plugins that simply supply Stylus APIs, we could add the path to the Stylus lookup paths. We do so by using the --include or -I flag:$ stylus test.styl --include ../nib/lib$ stylus test.styl --include ../nib/libNow yielding the output below. (As you might notice, calls to gradient-data-uri() and create-gradient-image() output as literals. This is because exposing the library path isn't enough when a plugin provides a JavaScript API. However, if we only wanted to use pure-Stylus nib functions, we'd be fine.)body { background: url(gradient-data-uri(create-gradient-image(20px, top))); background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fff), color-stop(1, #000)); background: -webkit-linear-gradient(top, #fff 0%, #000 100%); background: -moz-linear-gradient(top, #fff 0%, #000 100%); background: linear-gradient(top, #fff 0%, #000 100%);}body { background: url(gradient-data-uri(create-gradient-image(20px, top))); background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fff), color-stop(1, #000)); background: -webkit-linear-gradient(top, #fff 0%, #000 100%); background: -moz-linear-gradient(top, #fff 0%, #000 100%); background: linear-gradient(top, #fff 0%, #000 100%);}So, what we need to do is use the --use, or -u flag. It expects a path to a node module (with or without the .js extension). This require()s the module, expecting a function to be exported as module.exports, which then calls style.use(fn()) to expose the plugin (defining its js functions, etc.).$ stylus test.styl --use ../nib/lib/nib$ stylus test.styl --use ../nib/lib/nibYielding the expected result:body { background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAUCAYAAABMDlehAAAABmJLR0QA/wD/AP+gvaeTAAAAI0lEQVQImWP4+fPnf6bPnz8zMH358oUBwkIjKJBgYGNj+w8Aphk4blt0EcMAAAAASUVORK5CYII="); background: -webkit-gradient(linear, left top,
2025-04-14This element will receive instant changes as you edit the CSS rules on the left. Enjoy! /* ------------------------------------------------------------- CSS3, Please! =================================================== Update: We recommend using Autoprefixer instead of CSS3Please. You can edit the underlined values in this css file, but don't worry about making sure the corresponding values match, that's all done automagically for you. Whenever you want, you can copy the whole or part of this page and paste it into your own stylesheet.------------------------------------------------------------- */ .box_round { border-radius: 12px; background-clip: padding-box; } /* [to clipboard] [toggle rule off] */ .box_round { -moz-border-radius: 8px 8px 0px 0px; /* Firefox 1+ */ -webkit-border-top-left-radius: 8px; /* Safari 3-4 */ -webkit-border-top-right-radius: 8px; -webkit-border-bottom-right-radius: 0px; -webkit-border-bottom-left-radius: 0px; border-radius: 8px 8px 0px 0px; /* Chrome, IE 9+, Opera 10.50+, Safari 5+ */} /* */--> .box_shadow { -webkit-box-shadow: 0px 0px 4px 0px #ffffff; box-shadow: 0px 0px 4px 0px #ffffff; } .box_gradient { background-color: #444444; background-image: -webkit-linear-gradient(top, #444444, #999999); background-image: linear-gradient(to bottom, #444444, #999999); } .box_transition { -webkit-transition: all 0.3s ease-out; transition: all 0.3s ease-out; } .box_textshadow { text-shadow: 1px 1px 3px #888; } .box_opacity { opacity: 0.9; } * { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .box_bgsize { -webkit-background-size: 100% 100%; background-size: 100% 100%; } .box_animation:hover { -webkit-animation: myanim 5s infinite; animation: myanim 5s infinite; }@-webkit-keyframes myanim { 0% { opacity: 0.0; } 50% { opacity: 0.5; } 100% { opacity: 1.0; }}@keyframes myanim { 0% { opacity: 0.0; } 50% { opacity: 0.5; } 100% { opacity: 1.0; }} Oh hai :) From Peter Nederlof oh noes! Manipulate me, please! rotate scale skew skew move .matrix { } @font-face { font-family: 'WebFont'; src: url('myfont.woff') format('woff'), url('myfont.ttf') format('truetype'); } /* */ --> .box_tabsize { -moz-tab-size: 2; tab-size: 2;} /* */ -->/* __Changelog__ 2013.04.05: Opera 12.10 supports unprefixed CSS animations, gradients, transforms, and transitions. 2013.04.05: Removed
2025-04-18File with the name of styles.css and paste the given codes into your CSS file. Remember that you must create a file with the .css extension. * { margin: 0; padding: 0; box-sizing: border-box;}body { min-height: 100vh; overflow: hidden; display: flex; justify-content: center; align-items: center; flex-direction: column; font-family: "Montserrat", sans-serif;}hr { width: 40%; height: 4px; background: linear-gradient(0.25turn, #0096d0, #1d4e9d, #284995, #463e81, #762c61, #b91435, #e3051a, #940c22); border: none; margin-bottom: 1em;}.slidecontainer { width: 70%; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 50px; /* The slider itself */}.slidecontainer .slider { -webkit-appearance: none; appearance: none; width: 100%; height: 25px; outline: none; opacity: 0.7; -webkit-transition: 0.2s; transition: opacity 0.2s; background: linear-gradient(0.25turn, #0096d0, #1d4e9d, #284995, #463e81, #762c61, #b91435, #e3051a, #940c22); border-radius: 25px; /* The slider handle (use -webkit- (Chrome, Opera, Safari, Edge) and -moz- (Firefox) to override default look) */}.slidecontainer .slider:hover { opacity: 1;}.slidecontainer .slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 40px; height: 40px; background: #222; cursor: pointer; border-radius: 50%;}.slidecontainer .slider::-moz-range-thumb { width: 40px; height: 40px; background: #222; cursor: pointer; border-radius: 50%;} Step 3 (JavaScript Code): Finally, we need to create a temperature conversion function in JavaScript. Here's a breakdown of what the code does:1. The first line of code retrieves an element from the HTML document with the ID "myRange" and assigns it to the variable slider. This element is likely an input element of type "range" that allows the user to slide along a scale.2. The second line retrieves an element from the HTML document with the ID "fahrenheit" and assigns it to the variable fahrenheitOutput. This element is probably a placeholder where the Fahrenheit temperature value will be displayed.3. The third line retrieves an element from the HTML document with the ID "celsius" and assigns it to the variable celsiusOutput. This element serves as a placeholder for displaying the Celsius temperature
2025-03-28