Adjust css examples formatting (#26127)

This commit is contained in:
David Way
2018-12-13 05:03:03 +00:00
committed by Tom
parent 18d5502965
commit 012e93154b
35 changed files with 303 additions and 326 deletions

View File

@ -3,7 +3,7 @@ title: Image Opacity and Transparency
---
## Image Opacity and Transparency
The ```opacity``` property allows you to make an image transparent by lowering how opaque it is.
The ```opacity``` property allows you to make an image transparent by lowering how opaque it is.
```Opacity``` takes a value between 0.0 and 1.0.
@ -12,15 +12,15 @@ The ```opacity``` property allows you to make an image transparent by lowering h
Example:
```css
img {
opacity: 0.3;
}
```
Include ```filter: alpha(opacity=x)``` for IE8 and earlier. `x` takes a value from 0-100.
opacity: 0.3;
}
```
Include ```filter: alpha(opacity=x)``` for IE8 and earlier. The x takes a value from 0-100.
```css
img {
opacity: 0.3;
filter: alpha(opacity=30);
opacity: 0.3;
filter: alpha(opacity=30);
}
```
@ -34,12 +34,12 @@ You can pair ```opacity``` with ```:hover``` to create a dynamic mouse-over effe
Example:
```css
img {
opacity: 0.3;
filter: alpha(opacity=30);
opacity: 0.3;
filter: alpha(opacity=30);
}
img:hover {
opacity: 1.0;
filter: alpha(opacity=100);
opacity: 1.0;
filter: alpha(opacity=100);
}
```
[Here's a codepen example to show a transparent image turning opaque on hover](https://codepen.io/lvcoulter/full/JrzxXa/)
@ -50,8 +50,8 @@ You can create the opposite effect with less code since the image is 1.0 opacity
Example:
```css
img:hover {
opacity: 0.3;
filter: alpha(opacity=30);
opacity: 0.3;
filter: alpha(opacity=30);
}
```
[Here's a codepen example to show transparency on mouse-over](https://codepen.io/lvcoulter/full/xXBQoR/)
@ -59,8 +59,4 @@ img:hover {
#### More Information:
- w3schools.com: [CSS Opacity/Transparency](https://www.w3schools.com/css/css_image_transparency.asp)
- MDN Web Docs: [Opacity](https://developer.mozilla.org/en-US/docs/Web/CSS/opacity)