Guess most of us are familiar with SVG (Scalable Vector Graphic), but
for the novice. It's basically what you work with in Adobe Illustrator.
SVG images and their behaviors are defined in XML text files, which
means that they can be searched, indexed, scripted, and compressed.
SVG allows three types of graphic objects: vector graphics, raster graphics, and text. And being an XML file, it can be created and edited with any text editor.
SVG working with CSS
Styling SVG work the same way as in regular HTML elements, where HTML cares for content and structure, CSS cares for the looks. In SVG, text and shapes were handled by the markup and the looks can be controlled using presentation attributes and CSS.
There are two possible stylesheet languages for customizing SVG: XSL and CSS. The usage of CSS is very similar to how it is used in HTML.
In SVG, closed polygons, circles, ellipses, rectangles and round-cornered rectangles can be drawn. Also, straight-line paths and paths made up of a series of connected straight-line segments (polylines) are standard. Here's a list of all SVG elements.
Below is a code that produces a rectangular shape:
<svg>
<rect x="10" y="10" width="150" height="150" fill="grey" stroke="black" stroke-width="2"/>
</svg>
<rect x="10" y="10" width="150" height="150" fill="grey" stroke="black" stroke-width="2"/>
</svg>
As seen in the above example, we created a rectangle with the rect element, giving it a specific width and height, then instead of using the background-color property to give it a color (as it won't work on SVG shape), we set the color with a fill attribute. Colors are specified in the same way as in CSS2, i.e. using names like black, in hexadecimal such as #ccc or #dddddd, in decimal like rgb(255,255,127), or as percentages like rgb(100%,100%,50%).
SVG shapes can be filled and/or outlined with color, gradient, or pattern. The color and strength of the rectangle’s outer frame is defined by the attributes stroke and stroke-width.
Inline styles
Instead of using attributes, you can use inline CSS styles with identical property names:
<svg>
<rect x="10" y="10" width="150" height="150" style="fill: grey; stroke: black; stroke-width: 2px;"/>
</svg>
<rect x="10" y="10" width="150" height="150" style="fill: grey; stroke: black; stroke-width: 2px;"/>
</svg>
You won’t be able to define positions/margins and values for width and height within the inline style attribute. We will simply stick with x and y coordinates as well as width and height attributes.
Note: An !important declaration within a presentation attribute definition is an invalid value.
Also, note that presentation attributes count as low level “author stylesheets”. Meanwhile, style definition from the author (external stylesheets, document stylesheets and inline styles) will override it. Therefore, the rectangle in the following example will be red:
<svg>
<rect width="150" height="150" fill="grey" style="fill: red;"/>
</svg>
<rect width="150" height="150" fill="grey" style="fill: red;"/>
</svg>
Internal styles
Just as in HTML that we could work with classes and IDs on any element. In SVG, standard CSS selectors can also be used to apply styles to element types or those with specific IDs or class names, like:
<style type="text/css">
<![CDATA[
.example {
fill: grey;
stroke: black;
stroke-width: 2;
}
]]>
</style>
<svg>
<rect x="10" y="10" width ="150" height="150" class="example"/>
</svg>
<![CDATA[
.example {
fill: grey;
stroke: black;
stroke-width: 2;
}
]]>
</style>
<svg>
<rect x="10" y="10" width ="150" height="150" class="example"/>
</svg>
From the above example, we included our CSS stylesheets within a CDATA construct. This is very important, as CSS style sheets can include characters, such as >, which conflict with XML parsers. Even if your style sheets doesn't include any character, it's still recommended that you make use of the CDATA blocks.
External stylesheets
You might want to separate your stylesheets so they can be easier to maintain or reused elsewhere. Referencing external stylesheet in SVG is similar to the way we do it in HTML. But we will be using xml-stylesheet attribute instead of the link attribute, like:
<?xml-stylesheet type="text/css" href="style.css"?>
Grouping elements
With the <g> or <svg> structural element we can group several SVG shapes to share the same styles. It's as simple as:
<g style="fill: grey; stroke: black; stroke-width: 2;">
<rect x="203" width="150" height="150"/>
<circle cx="120" cy="80" r="76"/>
</g>
<rect x="203" width="150" height="150"/>
<circle cx="120" cy="80" r="76"/>
</g>
Using pseudo-classes
Dynamic pseudo-classes such as :hover, :active and :focus and pseudo-classes :first-child, :visited, :link and :lang can be used in SVG – even in combination with the CSS3 property like transition and transform:
<style type="text/css">
<![CDATA[
.example {
fill: slategrey;
stroke: black;
stroke-width: 2;
transition: all 2s ease;
}
.example:hover {
fill: blue;
}
]]>
</ style >
<svg>
<rect x="10" y="10" width ="150" height="150" class="example"/>
</svg>
<![CDATA[
.example {
fill: slategrey;
stroke: black;
stroke-width: 2;
transition: all 2s ease;
}
.example:hover {
fill: blue;
}
]]>
</ style >
<svg>
<rect x="10" y="10" width ="150" height="150" class="example"/>
</svg>
The code above will result in color change from slategrey to blue on hover. To make that work properly and for now-outdated web browsers capable of displaying SVG graphics, needed them embedded in <embed>, <object> or <iframe> elements to display them integrated as parts of an HTML webpage instead of using the standard way of integrating images with <img>.
<object type="image/svg+xml" src="example.svg"/>
Using <img> would certainly display the SVG correctly. But hover effects and transitions would be ignored.
SVG with responsive design
We can make an SVG file responsive. It's as simple as:
<style>
body {
width: 100%;
height: 100%;
overflow: hidden;
}
.example {
display: block;
width: 100%;
height: 100%;
margin: auto;
}
</style>
<body>
<object class="example" type="image/svg+xml" src="example.svg"/>
</body>
body {
width: 100%;
height: 100%;
overflow: hidden;
}
.example {
display: block;
width: 100%;
height: 100%;
margin: auto;
}
</style>
<body>
<object class="example" type="image/svg+xml" src="example.svg"/>
</body>
The size of the SVG file will be determined by the size of the screen viewing it. The file will appear at the center of the page and at maximum possible values. The quality remain the same regardless.
Also @media, @font-face, @import and @charset rules within stylesheets are supported.
Final words
The capabilities of styling SVG is very large. But in today post, I hope you have learn the basics? Despite the use of SVG on the web was limited by the lack of support in older versions of Internet Explorer (IE). You can enjoy its benefits while it gain more strength.
Subscribe For Free Updates!
*Please confirm the email sent to your inbox after clicking "Sign Up!".
Tricksabout.net
ReplyDeleteinternet Tricks
Blogging Tricks
Good article.Thank you so much for your great contribution.These kind of article is improving the writing.Waiting for new stuff.
ReplyDeletebest essay writing service
Amazing reading! It is a wonderful technique of spreading knowledge for readers. Keep sharing new things
ReplyDeletethe Walking dead jacket at amazon
http://diendanoto.biz/bai-viet/ga-rim-coca.5272/
ReplyDeletehttp://diendan.chungcu.edu.vn/threads/ga-rim-coca-hap-dn.77414/
http://gforum.vn/threads/g%C3%A0-rim-coca-h%E1%BA%A5p-d%E1%BA%ABn.172320/
http://giadinhsusu.com/threads/g%C3%A0-rim-coca-h%E1%BA%A5p-d%E1%BA%ABn.362542/
http://flfr.me/threads/ga-rim-coca-hap-dan.101968/
http://dulichnambo.net/threads/g%C3%A0-rim-coca-h%E1%BA%A5p-d%E1%BA%ABn.3624/
http://diendanvemaybay.edu.vn/threads/g%C3%A0-rim-coca-h%E1%BA%A5p-d%E1%BA%ABn.43983/
http://raovat.saigon365.net/showthread.php?396607-g%C3%A0-rim-coca-h%E1%BA%A5p-d%E1%BA%ABn&p=1279501
http://mastodonsea.com/threads/ga-rim-coca-hap-dan.24405/
http://chusao.net/threads/ga-rim-coca-hap-dan.296051/
http://diem10.com/threads/ga-rim-coca-hap-dan.12506.html
http://ttvnol.com/threads/ga-rim-coca-hap-dan.2979698/
http://ketban.laodong.com.vn/showthread.php?1060778-ga-rim-coca-hap-dan&p=1195594
http://phunu8.com/trao-doi-cong-viec/598998-ga-rim-coca-hap-dan.html
http://sentour.vn/threads/ga-rim-coca-hap-dan.9564.html
http://diendan.thichlamthem.com/threads/ga-rim-coca-hap-dan.9815/
http://thpt-bacly-hanam.edu.vn/threads/ga-rim-coca-hap-dan.6916.html
http://uptin247.com/threads/com-ga-xi-dau.122885/
http://ncnol.com/chu-de/com-ga-xi-dau.128187/
http://nurjyo.info/threads/com-ga-xi-du.103209/
This can help a lot in our programming spcially when we have lightbox wordpress plugin. This can be created and edited with any text editor.
ReplyDeleteThanks for taking the time to discuss this, I feel about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with more information? It is extremely helpful for me. Skandal Ngentot dengan Tetangga Toket Kecil
ReplyDeletebokep nikmat This is a very good post. Just wonderful. Nice one bokep terkini
ReplyDeleteiPhone have a line of smartphones designed and marketed by Apple Inc.Now to use Iphone 7 without any Problem and restrictions imposed by Iphone's IOS.
ReplyDeleteYou can Download iPhone 7 Jailbreak from CydiaNerd
play more games
ReplyDeletedewapoker
menangqq
balakqq
sinarqq
rajapoker88
I loved your article post. Awesome.
ReplyDeleteBandarPoker
BandarQ
Bandar kiu
Agen Poker
Agen QQ
Domino Online
outstanding tips for bloggers thank you...
ReplyDeleteSolidWorks 2017 Crack
IsoBuster v3.8 Crack
PowerMILL 2017 Crack
test tube baby process
article was very nice and helpful at all for me, thank you very much admin and pardon me permission to share articles herein may be useful for all of you in particular who are looking for :
ReplyDeleteCara mengatasi mata merah dan sakit
Obat maag akut
Obat tradisional encok
Thank you for sharing! Can you sharing some updates on how you have made this powerful post! Can you sharing some updates on how you have made this powerful post!
ReplyDeletegeometry dash | fb login | bloons tower defense 5
I like the news that you have written in a detail. Thank you>>>>Y8 Arcade
ReplyDeleteY8 Online
Yepi 2017
Friv 2017
Kizi Games
Y8 Games
Foto Bugil
ReplyDeletehammer of thor
hammer of thor
Foto Memek
Foto Ngentot
Halo bosku.. Bosan asik main judi online kalah-kalah aja? Buruan gabung bersama kami di
ReplyDeleteW W W .C U M A P O K E R . C O M dijamin no ROBOT bosku.
Kami menyediakan 7 jenis game dalam 1 user ID bosku
-AduQ
-BandarQ
-Poker
-Bandar Poker
-Capsa Susun
-Domino
-Sakong ( New Game yang sedang populer )
Bonus yang diberikan kepada seluruh member kami yaitu
-Bonus Turnover sebesar 0,5%
-Bonus Referal sebesar 15%
Kami menyediakan minimal deposit dan withdraw yang sangat rendah yakni Rp 15.000
Kami juga menyediakan game yang tidak kalah populer bosku.
-FISH HUNTER ( TEMBAK IKAN )
-SABUNG AYAM ( COCK FIGHT )
-JOKER SLOT
Jadi, tunggu apa lagi segera bergabung bersama kami dan dapatkan hadiah ratusan juta.
Yahoo : cumapoker88@yahoo.com
BBM : 2BE3DCA9
No HP : +85585569262
We chat : cumapoker
Bosdomino
ReplyDeleteDaftar Bosdomino
Link Alternatif Bosdomino
Agen Domino
BandarKiu
Judi Domino
Judi Online
a given article is very interesting and very useful for me, thank you very much admin and pardon me permission to share the article here :
ReplyDeleteCara mengatasi mata berair dan berpasir
Cara menyembuhkan batuk kering
Cara menyembuhkan abses payudara
Sakong
ReplyDeleteKitaQQ
Situs Sakong
AgenQQ
BandarQ
Dominoqiu
Daftar Game Android Terbaik
ReplyDeleteDaftarPoker
Javhub Online
LiveBerita
Review Kontes Seo
TipsBola
Download Software
AGEN DOMINO
ReplyDeleteAGENQQ
Situs Agen BandarQ
Situs KitaQQ
Kitaqq
Kita QQ
BandarQ Online
BandarQQ
Very Fantastic article, I really like your point of view!
ReplyDeleteGood Job And continue to make useful articles.
Sent from Honest Jvzoo Reviews
Sent from Scarcity Maximizer Review
I was recommended this blog by my cousin. I’m not sure whether this post is written by him as no
ReplyDeleteone else know such detailed about my difficulty.
You’re amazing! Thanks!
Berita terkini ahok
PKR
Bandar Q
LayarKaca21
This comment has been removed by the author.
ReplyDeleteHi to every single one, it’s actually a fastidious
ReplyDeletefor me to pay a visit this web page, it consists of important Information.
agen bonus terbesar
induk poker
domino88
free chip domino
bonus domino terbesar
link alternatif domino
An interesting dialogue is worth comment. I believe that you should write more on this subject, it may not be a taboo subject but generally people are not enough to talk on such topics. To the next. Cheers
ReplyDeleteMisteri
judi poker
Bandar Sakong
SejarahQQ
Bosdomino
Agen Sakong
This really interesting post. Thanks for sharing!
ReplyDelete- www.hotmail.com
- hotmail login
- hotmail sign up
- hotmail sign in
Dominokiukiu
ReplyDeleteDominokk
Agen Dominoq
Pokerace
Master Poker
I really like your blog! Continue to write more! Very interesting!
ReplyDeletebloxorz
great work Microsoft Office 365 Product Key
ReplyDeleteHi, after reading this amazing post i am too happy to
ReplyDeleteshare my know-how here with mates. Stranded Deep PC Game
Pretty section of content. I just stumbled upon your web site
ReplyDeleteand in accession capital to assert that I get in fact enjoyed account your
blog posts. Anyway I will be subscribing to your feeds and even I achievement
you access consistently quickly.UsbFix 2018 Crack Patch
Daftarkan diri anda dan bergabung bersama kami sekarang juga di VipjudiQQ
ReplyDeletecukup dengan 1 ID bisa merasakan 7 permainan sekaligus lohhhh...
rasakan sensasi fairplay 100% player vs player no BOT's no ADMIN !
I saw this site and read this article.it is helpful for me.thanks for writing. I create this site I want to you see this site and leave a coment.thanks!
ReplyDeletegoogle-sketchup
index review these details right here my response pop over to this website
ReplyDeletecheap designer bags replica w98 b3f21o4a01 Ysl replica g45 n2f83o3j70 replica bags buy online d57 c7r50p2g59
ReplyDelete