-
Notifications
You must be signed in to change notification settings - Fork 704
Дополняет html-доку svg
#5977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Дополняет html-доку svg
#5977
Changes from all commits
a58f1e8
384244c
e57b152
33264e0
5aa44df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -6,6 +6,7 @@ authors: | |||||
| contributors: | ||||||
| - skorobaeus | ||||||
| - parus7 | ||||||
| - kiryshka1922 | ||||||
| keywords: | ||||||
| - свг | ||||||
| - векторная графика | ||||||
|
|
@@ -131,7 +132,7 @@ SVG не может быть записано без оборачивающег | |||||
|
|
||||||
| ### Вставка в HTML | ||||||
|
|
||||||
| Код SVG можно вставить прямо в HTML-разметку страницы. | ||||||
| Код SVG можно вставить прямо в HTML-разметку страницы. Такой прием называют (SVG inline или inlining SVG). | ||||||
|
|
||||||
| ```html | ||||||
| <div class="dots"> | ||||||
|
|
@@ -173,6 +174,16 @@ SVG не может быть записано без оборачивающег | |||||
|
|
||||||
| Неприятная особенность: если одна и та же SVG-картинка используется в нескольких местах на сайте, и в какой-то момент вы захотите в ней что-то изменить, то нужно будет найти все вставки и вносить исправления в код. При вставке SVG при помощи `<img>` или `background-image` достаточно будет внести изменения в svg-файл и правки применяться ко всем картинкам. | ||||||
|
|
||||||
| ### [SVG-спрайты](/html/svg-sprite/) | ||||||
|
|
||||||
| Чтобы использовать иконку из спрайта на странице, нужно добавить внутрь тега `<svg>` тег [`<use>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/use) с обязательным атрибутом href. Данный атрибут должен ссылаться на файл спрайта с указанием id символа, содержащего нужное изображение. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Предлагаю дописать, что в старых проектах можно встретить
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Канцеляризм. Так звучит чуть менее формально
Suggested change
|
||||||
|
|
||||||
| ```html | ||||||
| <svg class="social-icon" viewBox="0 0 24 24" width="24" height="24"> | ||||||
| <use href="sprite.svg#social-vk"></use> | ||||||
| </svg> | ||||||
| ``` | ||||||
|
|
||||||
| ## Атрибуты | ||||||
|
|
||||||
| - `fill` — отвечает за заливку фигуры. Может использоваться как для всего контейнера `svg`, так и для отдельных частей. Более подробно тут → [fill](/css/fill/). | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| name: 'Кирилл Белоусов' | ||
| url: https://github.com/Kiryshka1922 | ||
| badges: | ||
| - first-contribution-small | ||
| --- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Привет, было бы здорово добавить демку для демонстрации этого подхода