mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
@ -6,15 +6,8 @@
|
||||
// --------------------------------------------------
|
||||
|
||||
:host {
|
||||
@include border-radius($avatar-ios-border-radius);
|
||||
--border-radius: #{$avatar-ios-border-radius};
|
||||
|
||||
width: $avatar-ios-width;
|
||||
height: $avatar-ios-height;
|
||||
}
|
||||
|
||||
::slotted(ion-img),
|
||||
::slotted(img) {
|
||||
@include border-radius($avatar-ios-border-radius);
|
||||
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@ -6,15 +6,8 @@
|
||||
// --------------------------------------------------
|
||||
|
||||
:host {
|
||||
@include border-radius($avatar-md-border-radius);
|
||||
--border-radius: #{$avatar-md-border-radius};
|
||||
|
||||
width: $avatar-md-width;
|
||||
height: $avatar-md-height;
|
||||
}
|
||||
|
||||
::slotted(ion-img),
|
||||
::slotted(img) {
|
||||
@include border-radius($avatar-md-border-radius);
|
||||
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@ -5,13 +5,22 @@
|
||||
// --------------------------------------------------
|
||||
|
||||
:host {
|
||||
/**
|
||||
* @prop --border-radius: Border radius of the avatar and inner image
|
||||
*/
|
||||
@include border-radius(var(--border-radius));
|
||||
|
||||
display: block;
|
||||
}
|
||||
|
||||
::slotted(ion-img),
|
||||
::slotted(img) {
|
||||
@include border-radius(var(--border-radius));
|
||||
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
object-fit: cover;
|
||||
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@ -8,6 +8,12 @@ Avatars can be used by themselves or inside of any element. If placed inside of
|
||||
<!-- Auto Generated Below -->
|
||||
|
||||
|
||||
## CSS Custom Properties
|
||||
|
||||
| Name | Description |
|
||||
| ----------------- | ------------------------------------------- |
|
||||
| `--border-radius` | Border radius of the avatar and inner image |
|
||||
|
||||
|
||||
----------------------------------------------
|
||||
|
||||
|
||||
@ -9,9 +9,19 @@
|
||||
<link rel="stylesheet" type="text/css" href="/css/ionic.min.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body padding>
|
||||
<h1>Default</h1>
|
||||
<ion-avatar>
|
||||
<img src="https://images.unsplash.com/photo-1485832329521-e944d75fa65e?auto=format&fit=crop&w=500&q=80&ixid=dW5zcGxhc2guY29tOzs7Ozs%3D"/>
|
||||
</ion-avatar>
|
||||
|
||||
<h1>Custom</h1>
|
||||
<ion-avatar style="width: 200px; height: 200px">
|
||||
<img src="https://images.unsplash.com/photo-1485832329521-e944d75fa65e?auto=format&fit=crop&w=500&q=80&ixid=dW5zcGxhc2guY29tOzs7Ozs%3D"/>
|
||||
</ion-avatar>
|
||||
|
||||
<ion-avatar style="--border-radius: 4px;">
|
||||
<img src="https://images.unsplash.com/photo-1485832329521-e944d75fa65e?auto=format&fit=crop&w=500&q=80&ixid=dW5zcGxhc2guY29tOzs7Ozs%3D"/>
|
||||
</ion-avatar>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user