SlideShare uma empresa Scribd logo
1 de 14
<!DOCTYPE html>background
<html>
<body>
<h1>Hello World!</h1>
<button onclick="myFunction()">Setbackground</button>
<script>
functionmyFunction() {
document.body.style.background="#f3f3f3 url('img_tree.png') no-repeatrighttop";
}
</script>
</body>
</html>
<!DOCTYPE html>backgroundAttachment
<html>
<head>
<style>
body {
background: #f3f3f3 url('img_tree.png') no-repeatrighttop;
}
</style>
</head>
<body>
<h1>Hello World!</h1>
<p><b>Tip:</b> Try to to resize the window ifthe scrollbar is not available.</p>
<p><b>Tip:</b> Scroll the page before and after you have clickedthe button.</p>
<button onclick="myFunction()">Setbackgroundimage to be fixed</button>
<br>
<script>
functionmyFunction() {
document.body.style.backgroundAttachment="fixed";
}
</script>
<p>Some text to enable scrolling..
<br><br><br><br>
<br><br><br><br>
</p>
</body>
</html>
<!DOCTYPE html>backgroundColor
<html>
<body>
<h1>Hello World!</h1>
<button type="button" onclick="myFunction()">Setbackground color</button>
<script>
functionmyFunction() {
document.body.style.backgroundColor="red";
}
</script>
</body>
</html>
<!DOCTYPE html>backgroundImage
<html>
<body>
<h1>Hello World!</h1>
<button type="button" onclick="myFunction()">Setbackgroundimage</button>
<script>
functionmyFunction() {
document.body.style.backgroundColor="#f3f3f3";
document.body.style.backgroundImage ="url('img_tree.png')";
}
</script>
</body>
</html>
<!DOCTYPE html>backgroundPosition
<html>
<head>
<style>
body {
background-image:url('img_tree.png');
background-repeat:no-repeat;
}
</style>
</head>
<body>
<button type="button" onclick="myFunction()">Positionbackgroundimage</button>
<script>
functionmyFunction() {
document.body.style.backgroundPosition="topright";
}
</script>
</body>
</html>
<!DOCTYPE html>backgroundRepeat
<html>
<head>
<style>
body {
background: #f3f3f3 url('img_tree.png');
}
</style>
</head>
<body>
<h1>Hello World!</h1>
<button type="button" onclick="myFunction()">Setbackground image to no-repeat</button>
<script>
functionmyFunction() {
document.body.style.backgroundRepeat= "no-repeat";
}
</script>
</body>
</html>
<!DOCTYPE html>backgroundClip
<html>
<head>
<style>
#myDIV {
width: 300px;
height:300px;
padding: 50px;
background-color: coral;
background-clip:border-box;
color: white;
border: 5px dotted lightgrey;
}
</style>
</head>
<body>
<p>Click the "Try it" button to setthe background-clipproperty of the DIV elementto "content-
box":</p>
<button onclick="myFunction()">Tryit</button>
<div id="myDIV">
Lorem ipsumdolor sit amet, consectetueradipiscingelit,seddiam nonummynibh euismodtincidunt
ut laoreetdolore magna aliquam erat volutpat. Ut wisi enimad minimveniam,quis nostrud exerci
</div>
<script>
functionmyFunction() {
document.getElementById("myDIV").style.backgroundClip="content-box";
}
</script>
</body>
</html>
<!DOCTYPE html>backgroundSize
<html>
<head>
<style>
#myDIV {
border: 1px solid black;
width: 300px;
height:300px;
background: url('smiley.gif') no-repeat;
}
</style>
</head>
<body>
<p>Click the "Try it" button to enlarge the background-size of the DIV element:</p>
<button onclick="myFunction()">Tryit</button>
<div id="myDIV">
<h1>Hello</h1>
</div>
<script>
functionmyFunction() {
document.getElementById("myDIV").style.backgroundSize ="60px120px";
}
</script>
</body>
</html>
<!DOCTYPE html>backfaceVisibility
<html>
<head>
<style>
div {
width: 100px;
height:100px;
background: red;
color: white;
-webkit-animation:mymove 2s infinite linearalternate;/* Chrome,Safari, Opera */
animation: mymove 2s infinite linearalternate;
}
/* Chrome,Safari, Opera */
@-webkit-keyframesmymove {
to {-webkit-transform:rotateY(180deg);}
}
@keyframesmymove {
to {transform: rotateY(180deg);}
}
</style>
</head>
<body>
<p>Check/uncheck the checkbox to change the backface-visibilityofthe animated DIV element:</p>
<div id="myDIV">
<h1>Hello</h1>
</div>
<input type="checkbox" onclick="myFunction(this)" checked>backface-visibility
<script>
functionmyFunction(x) {
if(x.checked=== true) {
document.getElementById("myDIV").style.WebkitBackfaceVisibility="visible";//Code for Chrome,
Safari, Opera
document.getElementById("myDIV").style.backfaceVisibility="visible";
} else {
document.getElementById("myDIV").style.WebkitBackfaceVisibility="hidden";// Code for
Chrome,Safari, Opera
document.getElementById("myDIV").style.backfaceVisibility="hidden";
}
}
</script>
<p><strong>Note:</strong> The backface-visibilityandbackfaceVisibilitypropertiesare notsupported
in InternetExplorer9 and earlierversions.</p>
</body>
</html>
<!DOCTYPE html>border
<html>
<body>
<div id="myDiv">Thisisa div element.</div>
<br>
<button type="button" onclick="myFunction()">Setborder</button>
<script>
functionmyFunction() {
document.getElementById("myDiv").style.border="thicksolid #0000FF";
}
</script>
</body>
</html>
document.getElementById("myDiv").style.borderBottom="thicksolid#0000FF";
document.getElementById("myDiv").style.borderBottomColor="red";
<!DOCTYPE html>borderBottomLeftRadius
<html>
<head>
<style>
#myDIV {
border: 1px solid black;
width: 300px;
height:300px;
}
</style>
</head>
<body>
<p>Click the "Try it" button to change the border-bottom-left-radiuspropertyofthe DIV
element:</p>
<button onclick="myFunction()">Tryit</button>
<div id="myDIV">
<h1>Hello</h1>
</div>
<script>
functionmyFunction() {
document.getElementById("myDIV").style.borderBottomLeftRadius="25px";
document.getElementById("myDIV").style.borderBottomLeftRadius="25px";
}
</script>
</body>
</html>
<!DOCTYPE html>borderBottomStyle
<html>
<body>
<div id="myDiv">Thisisa div.</div>
<br>
<button type="button" onclick="myFunction()">Setsolidbottomborder</button>
<script>
functionmyFunction() {
document.getElementById("myDiv").style.borderBottomStyle="solid";
}
</script>
</body>
</html>
<!DOCTYPE html>borderBottomWidth
<html>
<head>
<style>
#myDiv {
border-style:solid;
}
</style>
</head>
<body>
<div id="myDiv">Thisisa div element.</div>
<br>
<button type="button" onclick="myFunction()">Change widthofthe bottom border</button>
<script>
functionmyFunction() {
document.getElementById("myDiv").style.borderBottomWidth="10px";
}
</script>
</body>
</html>
<!DOCTYPE html>borderCollapse
<html>
<body>
<table id="myTable" border="1">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$150</td>
</tr>
</table>
<br>
<button type="button" onclick="myFunction()">Collapseborder</button>
<script>
functionmyFunction() {
document.getElementById("myTable").style.borderCollapse ="collapse";
}
</script>
</body>
</html>
<!DOCTYPE html>borderColor
<html>
<head>
<style>
#myDiv {
border: thick solidblue;
}
</style>
</head>
<body>
<div id="myDiv">Thisisa div.</div>
<br>
<button type="button" onclick="myFunction()">Change colorofthe four borders</button>
<script>
functionmyFunction() {
document.getElementById("myDiv").style.borderColor="red";
}
</script>
</body>
</html>
<!DOCTYPE html>borderColor
<html>
<head>
<style>
#myDIV {
border: 15px solidtransparent;
width: 250px;
padding: 10px 20px;
-webkit-border-image:url(border.png) 3030 stretch; /* Safari 5 */
-o-border-image:url(border.png) 3030 stretch; /* Opera 12 */
border-image:url(border.png) 30 30 stretch;
}
</style>
</head>
<body>
<p>Click the "Try it" button to change the border-image propertyof the DIV element:</p>
<button onclick="myFunction()">Tryit</button>
<div id="myDIV">
<h1>Hello</h1>
</div>
<script>
functionmyFunction() {
document.getElementById("myDIV").style.WebkitBorderImage ="url(border.png) 30 30 round"; /*
Code for Safari 5 */
document.getElementById("myDIV").style.OBorderImage ="url(border.png) 30 30 round"; /* Code
for Opera 12 */
document.getElementById("myDIV").style.borderImage ="url(border.png) 3030 round";
}
</script>
</body>
</html>
<!DOCTYPE html>boxShadow
<html>
<head>
<style>
#myDIV {
position:absolute;
width: 100px;
height:100px;
background-color: coral;
color: white;
}
</style>
</head>
<body>
<p>Click the "Try it" button to setthe boxShadow property of the DIV element:</p>
<button onclick="myFunction()">Tryit</button>
<div id="myDIV">
<h1>myDIV</h1>
</div>
<script>
functionmyFunction() {
document.getElementById("myDIV").style.boxShadow="10px 20px 30px lightblue";
}
</script>
</body>
</html>
<!DOCTYPE html>display
<html>
<head>
<style>
#myDIV {
width: 500px;
height:500px;
background-color: lightblue;
}
</style>
</head>
<body>
<p>Click the "Try it" button to setthe displayproperty of the DIV elementto"none":</p>
<button onclick="myFunction()">Tryit</button>
<div id="myDIV">
This is my DIV element.
</div>
<p><b>Note:</b> The elementwill nottake up any space whenthe displayproperty set to
"none".</p>
<script>
functionmyFunction() {
document.getElementById("myDIV").style.display="none";
}
</script>
</body>
</html>
<!DOCTYPE html>Style cursor Property
<html>
<body>
<p id="myP">Mouse overthis textbefore and after you have clickedthe button below!</p>
<button type="button" onclick="myFunction()">Change cursor</button>
<script>
functionmyFunction() {
document.getElementById("myP").style.cursor= "pointer";
}
</script>
</body>
</html>
<!DOCTYPE html>font
<html>
<body>
<p id="myP">Thisis a paragraph.</p>
<button type="button" onclick="myFunction()">Setfont</button>
<script>
functionmyFunction() {
document.getElementById("myP").style.font="italicbold 20px arial,serif";
}
</script>
</body>
</html>
document.getElementById("myP").style.fontFamily="Impact,Charcoal,sans-serif";
document.getElementById("myP").style.fontFamily="Impact,Charcoal,sans-serif";
document.getElementById("myP").style.fontSize ="xx-large";
document.getElementById("myP").style.fontStyle="italic";
document.getElementById("myP").style.fontVariant="small-caps";
document.getElementById("myBtn").style.height="50px";
document.getElementById("main".style.justifyContent="space-between";
document.getElementById("myBtn").style.left="100px";
document.getElementById("myP").style.letterSpacing="15px";
document.getElementById("myDiv").style.lineHeight="3";
document.getElementById("myList").style.listStyle ="decimal inside";
document.getElementById("myList").style.listStyleImage="url('sqorange.gif')";
document.getElementById("myDiv").style.margin="50px 10px 20px 30px";
document.getElementById("myDiv").style.marginBottom="50px";
<!DOCTYPE html>overflow
<html>
<head>
<style>
#myDIV {
border: 1px solid black;
background-color: lightblue;
width: 300px;
height:210px;
overflow:visible;
}
</style>
</head>
<body>
<p>Click the "Try it" button to change the overflowproperty ofthe DIV element:</p>
<button onclick="myFunction()">Tryit</button>
<div id="myDIV">
Lorem ipsumdolor sit amet, consectetueradipiscingelit,seddiam nonummynibh euismodtincidunt
ut laoreetdolore magna aliquam erat volutpat. Ut wisi enimad minimveniam,quis nostrud exerci
type extra
</div>
<script>
functionmyFunction() {
document.getElementById("myDIV").style.overflow="scroll";
}
</script>
</body>
</html>
document.getElementById("myDIV").style.overflowX="scroll";
document.getElementById("myDIV").style.overflowX="scroll";
document.getElementById("myDiv").style.padding="50px 10px 20px 30px";
<!DOCTYPE html> Transform
<html>
<head>
<style>
#myDIV {
margin: auto;
border: 1px solid black;
width: 200px;
height:100px;
background-color: coral;
color: white;
}
</style>
</head>
<body>
<p>Click the "Try it" button to rotate the DIV element:</p>
<button onclick="myFunction()">Tryit</button>
<div id="myDIV">
<h1>myDIV</h1>
</div>
<script>
functionmyFunction() {
// Code for Chrome, Safari, Opera
document.getElementById("myDIV").style.WebkitTransform="rotate(20deg)";
// Code for IE9
document.getElementById("myDIV").style.msTransform="rotate(20deg)";
// Standard syntax
document.getElementById("myDIV").style.transform="rotate(20deg)";
}
</script>
</body>
</html>
<!DOCTYPE html>transitionTimingFunction
<html>
<head>
<style>
#myDIV {
border: 1px solid black;
background-color: lightblue;
width: 270px;
height:200px;
overflow:auto;
-webkit-transition:all 2s; /* For Safari 3.1 to 6.0 */
transition: all 2s;
}
#myDIV:hover {
background-color: coral;
width: 570px;
height:500px;
padding: 100px;
border-radius:50px;
}
</style>
</head>
<body>
<p>Mouse overthe DIV elementand it will change,gradually, both in color and size!</p>
<p>Click the "Try it" button and mouse over the DIV elementagain. The changes will now happen ina
linearspeedcurve.</p>
<button onclick="myFunction()">Tryit</button>
<div id="myDIV">
<h1>myDIV</h1>
</div>
<script>
functionmyFunction() {
document.getElementById("myDIV").style.WebkitTransitionTimingFunction="linear";// Code for
Safari 3.1 to 6.0
document.getElementById("myDIV").style.transitionTimingFunction ="linear"; // Standard
syntax
}
</script>
<p><strong>Note:</strong> The transitionTimingFunctionpropertyis supportedin InternetExplorer
10, Firefox,Opera,and Chrome.</p>
<p>Safari supports an alternative,the WebkitTransitionTimingFunctionproperty.</p>
</body>
</html>

Mais conteúdo relacionado

Mais procurados

The project gutenberg e book, fairy tales from brazil, by elsie spicer
The project gutenberg e book, fairy tales from brazil, by elsie spicerThe project gutenberg e book, fairy tales from brazil, by elsie spicer
The project gutenberg e book, fairy tales from brazil, by elsie spicerAndrei Hortúa
 
2013-06-25 - HTML5 & JavaScript Security
2013-06-25 - HTML5 & JavaScript Security2013-06-25 - HTML5 & JavaScript Security
2013-06-25 - HTML5 & JavaScript SecurityJohannes Hoppe
 
Laravel 로 배우는 서버사이드 #5
Laravel 로 배우는 서버사이드 #5Laravel 로 배우는 서버사이드 #5
Laravel 로 배우는 서버사이드 #5성일 한
 
jQtouch, Building Awesome Webapps
jQtouch, Building Awesome WebappsjQtouch, Building Awesome Webapps
jQtouch, Building Awesome WebappsHome
 
Why You Should be Using Web Components Right Now. And How. ForwardJS July 2015
Why You Should be Using Web Components Right Now. And How. ForwardJS July 2015Why You Should be Using Web Components Right Now. And How. ForwardJS July 2015
Why You Should be Using Web Components Right Now. And How. ForwardJS July 2015Phil Leggetter
 
ChocolateChip-UI
ChocolateChip-UIChocolateChip-UI
ChocolateChip-UIGeorgeIshak
 
Implement rich snippets in your webshop
Implement rich snippets in your webshopImplement rich snippets in your webshop
Implement rich snippets in your webshopArjen Miedema
 
Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Remy Sharp
 
Why you should be using Web Components. And How - DevWeek 2015
Why you should be using Web Components. And How - DevWeek 2015Why you should be using Web Components. And How - DevWeek 2015
Why you should be using Web Components. And How - DevWeek 2015Phil Leggetter
 
ActiveResource & REST
ActiveResource & RESTActiveResource & REST
ActiveResource & RESTRobbert
 
jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009Ralph Whitbeck
 
Odoo - Create themes for website
Odoo - Create themes for websiteOdoo - Create themes for website
Odoo - Create themes for websiteOdoo
 
Unlock the next era of UI design with Polymer
Unlock the next era of UI design with PolymerUnlock the next era of UI design with Polymer
Unlock the next era of UI design with PolymerRob Dodson
 
Web UI performance tuning
Web UI performance tuningWeb UI performance tuning
Web UI performance tuningAndy Pemberton
 
FrontInBahia 2014: 10 dicas de desempenho para apps mobile híbridas
FrontInBahia 2014: 10 dicas de desempenho para apps mobile híbridasFrontInBahia 2014: 10 dicas de desempenho para apps mobile híbridas
FrontInBahia 2014: 10 dicas de desempenho para apps mobile híbridasLoiane Groner
 

Mais procurados (20)

jQuery UI and Plugins
jQuery UI and PluginsjQuery UI and Plugins
jQuery UI and Plugins
 
The project gutenberg e book, fairy tales from brazil, by elsie spicer
The project gutenberg e book, fairy tales from brazil, by elsie spicerThe project gutenberg e book, fairy tales from brazil, by elsie spicer
The project gutenberg e book, fairy tales from brazil, by elsie spicer
 
2013-06-25 - HTML5 & JavaScript Security
2013-06-25 - HTML5 & JavaScript Security2013-06-25 - HTML5 & JavaScript Security
2013-06-25 - HTML5 & JavaScript Security
 
Laravel 로 배우는 서버사이드 #5
Laravel 로 배우는 서버사이드 #5Laravel 로 배우는 서버사이드 #5
Laravel 로 배우는 서버사이드 #5
 
jQtouch, Building Awesome Webapps
jQtouch, Building Awesome WebappsjQtouch, Building Awesome Webapps
jQtouch, Building Awesome Webapps
 
Html5 101
Html5 101Html5 101
Html5 101
 
Why You Should be Using Web Components Right Now. And How. ForwardJS July 2015
Why You Should be Using Web Components Right Now. And How. ForwardJS July 2015Why You Should be Using Web Components Right Now. And How. ForwardJS July 2015
Why You Should be Using Web Components Right Now. And How. ForwardJS July 2015
 
ChocolateChip-UI
ChocolateChip-UIChocolateChip-UI
ChocolateChip-UI
 
Implement rich snippets in your webshop
Implement rich snippets in your webshopImplement rich snippets in your webshop
Implement rich snippets in your webshop
 
Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)
 
Why you should be using Web Components. And How - DevWeek 2015
Why you should be using Web Components. And How - DevWeek 2015Why you should be using Web Components. And How - DevWeek 2015
Why you should be using Web Components. And How - DevWeek 2015
 
Html5 101
Html5 101Html5 101
Html5 101
 
ActiveResource & REST
ActiveResource & RESTActiveResource & REST
ActiveResource & REST
 
jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009
 
The Thinking behind BEM
The Thinking behind BEMThe Thinking behind BEM
The Thinking behind BEM
 
Odoo - Create themes for website
Odoo - Create themes for websiteOdoo - Create themes for website
Odoo - Create themes for website
 
Unlock the next era of UI design with Polymer
Unlock the next era of UI design with PolymerUnlock the next era of UI design with Polymer
Unlock the next era of UI design with Polymer
 
Web Components Revolution
Web Components RevolutionWeb Components Revolution
Web Components Revolution
 
Web UI performance tuning
Web UI performance tuningWeb UI performance tuning
Web UI performance tuning
 
FrontInBahia 2014: 10 dicas de desempenho para apps mobile híbridas
FrontInBahia 2014: 10 dicas de desempenho para apps mobile híbridasFrontInBahia 2014: 10 dicas de desempenho para apps mobile híbridas
FrontInBahia 2014: 10 dicas de desempenho para apps mobile híbridas
 

Destaque

7 Ways to Embrace in Occupational Therapy Month
7 Ways to Embrace in Occupational Therapy Month7 Ways to Embrace in Occupational Therapy Month
7 Ways to Embrace in Occupational Therapy MonthShock Aid
 
Daily Assistance Devices
Daily Assistance DevicesDaily Assistance Devices
Daily Assistance DevicesShock Aid
 
Sarah Roth CV August 2015
Sarah Roth CV August 2015Sarah Roth CV August 2015
Sarah Roth CV August 2015Sarah Roth
 
Matte areal 5.trinn
Matte areal 5.trinnMatte areal 5.trinn
Matte areal 5.trinnDagThomas
 
Internet Of Things
Internet Of ThingsInternet Of Things
Internet Of Thingsdefisafitri
 
Vaccine ppt
Vaccine pptVaccine ppt
Vaccine pptidjf
 
Politici naţionalr şi internaţionale în privinţa protejării mediului
Politici naţionalr şi internaţionale în privinţa protejării mediuluiPolitici naţionalr şi internaţionale în privinţa protejării mediului
Politici naţionalr şi internaţionale în privinţa protejării mediuluielenabadragan
 

Destaque (11)

7 Ways to Embrace in Occupational Therapy Month
7 Ways to Embrace in Occupational Therapy Month7 Ways to Embrace in Occupational Therapy Month
7 Ways to Embrace in Occupational Therapy Month
 
Daily Assistance Devices
Daily Assistance DevicesDaily Assistance Devices
Daily Assistance Devices
 
Simon CV June 2015
Simon CV June 2015Simon CV June 2015
Simon CV June 2015
 
Sarah Roth CV August 2015
Sarah Roth CV August 2015Sarah Roth CV August 2015
Sarah Roth CV August 2015
 
Ibrahim_Anwar_CV
Ibrahim_Anwar_CVIbrahim_Anwar_CV
Ibrahim_Anwar_CV
 
Matte areal 5.trinn
Matte areal 5.trinnMatte areal 5.trinn
Matte areal 5.trinn
 
Ceremonia
CeremoniaCeremonia
Ceremonia
 
Internet Of Things
Internet Of ThingsInternet Of Things
Internet Of Things
 
Vaccine ppt
Vaccine pptVaccine ppt
Vaccine ppt
 
Skin icare
Skin icareSkin icare
Skin icare
 
Politici naţionalr şi internaţionale în privinţa protejării mediului
Politici naţionalr şi internaţionale în privinţa protejării mediuluiPolitici naţionalr şi internaţionale în privinţa protejării mediului
Politici naţionalr şi internaţionale în privinţa protejării mediului
 

Semelhante a Change HTML element styles with JavaScript

2. CSS Chapter Roadmap and Full Source Code.pdf
2. CSS Chapter Roadmap and Full Source Code.pdf2. CSS Chapter Roadmap and Full Source Code.pdf
2. CSS Chapter Roadmap and Full Source Code.pdfBdBangladesh
 
HTML5 and the dawn of rich mobile web applications pt 2
HTML5 and the dawn of rich mobile web applications pt 2HTML5 and the dawn of rich mobile web applications pt 2
HTML5 and the dawn of rich mobile web applications pt 2James Pearce
 
Devoxx 2014-webComponents
Devoxx 2014-webComponentsDevoxx 2014-webComponents
Devoxx 2014-webComponentsCyril Balit
 
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and ImprovedTimothy Fisher
 
引き出しとしてのDjango - SoozyCon7
引き出しとしてのDjango - SoozyCon7引き出しとしてのDjango - SoozyCon7
引き出しとしてのDjango - SoozyCon7makoto tsuyuki
 
TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!
TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!
TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!Coulawrence
 
jQuery Mobile - Desenvolvimento para dispositivos móveis
jQuery Mobile - Desenvolvimento para dispositivos móveisjQuery Mobile - Desenvolvimento para dispositivos móveis
jQuery Mobile - Desenvolvimento para dispositivos móveisPablo Garrido
 
Introduction to modern front-end with Vue.js
Introduction to modern front-end with Vue.jsIntroduction to modern front-end with Vue.js
Introduction to modern front-end with Vue.jsmonterail
 
jQuery Mobile Introduction ( demo on EZoapp )
jQuery Mobile Introduction ( demo on EZoapp )jQuery Mobile Introduction ( demo on EZoapp )
jQuery Mobile Introduction ( demo on EZoapp )EZoApp
 
web design and jQuery introduction in persian
web design and jQuery introduction in persianweb design and jQuery introduction in persian
web design and jQuery introduction in persianAhmad Badpey
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoRob Bontekoe
 
Client-side Transformations
Client-side TransformationsClient-side Transformations
Client-side TransformationsJohn Boxall
 

Semelhante a Change HTML element styles with JavaScript (20)

Imageslider
ImagesliderImageslider
Imageslider
 
Stole16
Stole16Stole16
Stole16
 
2. CSS Chapter Roadmap and Full Source Code.pdf
2. CSS Chapter Roadmap and Full Source Code.pdf2. CSS Chapter Roadmap and Full Source Code.pdf
2. CSS Chapter Roadmap and Full Source Code.pdf
 
Front end ++: seo e flexbox
Front end ++: seo e flexboxFront end ++: seo e flexbox
Front end ++: seo e flexbox
 
HTML5 and the dawn of rich mobile web applications pt 2
HTML5 and the dawn of rich mobile web applications pt 2HTML5 and the dawn of rich mobile web applications pt 2
HTML5 and the dawn of rich mobile web applications pt 2
 
Devoxx 2014-webComponents
Devoxx 2014-webComponentsDevoxx 2014-webComponents
Devoxx 2014-webComponents
 
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and Improved
 
ppt.pptx
ppt.pptxppt.pptx
ppt.pptx
 
引き出しとしてのDjango - SoozyCon7
引き出しとしてのDjango - SoozyCon7引き出しとしてのDjango - SoozyCon7
引き出しとしてのDjango - SoozyCon7
 
TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!
TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!
TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!
 
Polymer 1.0
Polymer 1.0Polymer 1.0
Polymer 1.0
 
Polymer
PolymerPolymer
Polymer
 
jQuery Mobile - Desenvolvimento para dispositivos móveis
jQuery Mobile - Desenvolvimento para dispositivos móveisjQuery Mobile - Desenvolvimento para dispositivos móveis
jQuery Mobile - Desenvolvimento para dispositivos móveis
 
Introduction to modern front-end with Vue.js
Introduction to modern front-end with Vue.jsIntroduction to modern front-end with Vue.js
Introduction to modern front-end with Vue.js
 
jQuery Mobile Introduction ( demo on EZoapp )
jQuery Mobile Introduction ( demo on EZoapp )jQuery Mobile Introduction ( demo on EZoapp )
jQuery Mobile Introduction ( demo on EZoapp )
 
web design and jQuery introduction in persian
web design and jQuery introduction in persianweb design and jQuery introduction in persian
web design and jQuery introduction in persian
 
DOM.pptx
DOM.pptxDOM.pptx
DOM.pptx
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" Domino
 
Client-side Transformations
Client-side TransformationsClient-side Transformations
Client-side Transformations
 
Hmmmm
HmmmmHmmmm
Hmmmm
 

Último

call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 

Último (20)

FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 

Change HTML element styles with JavaScript

  • 1. <!DOCTYPE html>background <html> <body> <h1>Hello World!</h1> <button onclick="myFunction()">Setbackground</button> <script> functionmyFunction() { document.body.style.background="#f3f3f3 url('img_tree.png') no-repeatrighttop"; } </script> </body> </html> <!DOCTYPE html>backgroundAttachment <html> <head> <style> body { background: #f3f3f3 url('img_tree.png') no-repeatrighttop; } </style> </head> <body> <h1>Hello World!</h1> <p><b>Tip:</b> Try to to resize the window ifthe scrollbar is not available.</p> <p><b>Tip:</b> Scroll the page before and after you have clickedthe button.</p> <button onclick="myFunction()">Setbackgroundimage to be fixed</button> <br> <script> functionmyFunction() { document.body.style.backgroundAttachment="fixed"; } </script> <p>Some text to enable scrolling.. <br><br><br><br> <br><br><br><br> </p> </body> </html>
  • 2. <!DOCTYPE html>backgroundColor <html> <body> <h1>Hello World!</h1> <button type="button" onclick="myFunction()">Setbackground color</button> <script> functionmyFunction() { document.body.style.backgroundColor="red"; } </script> </body> </html> <!DOCTYPE html>backgroundImage <html> <body> <h1>Hello World!</h1> <button type="button" onclick="myFunction()">Setbackgroundimage</button> <script> functionmyFunction() { document.body.style.backgroundColor="#f3f3f3"; document.body.style.backgroundImage ="url('img_tree.png')"; } </script> </body> </html> <!DOCTYPE html>backgroundPosition <html> <head> <style> body { background-image:url('img_tree.png'); background-repeat:no-repeat; } </style> </head> <body> <button type="button" onclick="myFunction()">Positionbackgroundimage</button>
  • 3. <script> functionmyFunction() { document.body.style.backgroundPosition="topright"; } </script> </body> </html> <!DOCTYPE html>backgroundRepeat <html> <head> <style> body { background: #f3f3f3 url('img_tree.png'); } </style> </head> <body> <h1>Hello World!</h1> <button type="button" onclick="myFunction()">Setbackground image to no-repeat</button> <script> functionmyFunction() { document.body.style.backgroundRepeat= "no-repeat"; } </script> </body> </html> <!DOCTYPE html>backgroundClip <html> <head> <style> #myDIV { width: 300px; height:300px; padding: 50px; background-color: coral; background-clip:border-box; color: white; border: 5px dotted lightgrey; } </style> </head> <body>
  • 4. <p>Click the "Try it" button to setthe background-clipproperty of the DIV elementto "content- box":</p> <button onclick="myFunction()">Tryit</button> <div id="myDIV"> Lorem ipsumdolor sit amet, consectetueradipiscingelit,seddiam nonummynibh euismodtincidunt ut laoreetdolore magna aliquam erat volutpat. Ut wisi enimad minimveniam,quis nostrud exerci </div> <script> functionmyFunction() { document.getElementById("myDIV").style.backgroundClip="content-box"; } </script> </body> </html> <!DOCTYPE html>backgroundSize <html> <head> <style> #myDIV { border: 1px solid black; width: 300px; height:300px; background: url('smiley.gif') no-repeat; } </style> </head> <body> <p>Click the "Try it" button to enlarge the background-size of the DIV element:</p> <button onclick="myFunction()">Tryit</button> <div id="myDIV"> <h1>Hello</h1> </div> <script> functionmyFunction() { document.getElementById("myDIV").style.backgroundSize ="60px120px"; } </script> </body> </html>
  • 5. <!DOCTYPE html>backfaceVisibility <html> <head> <style> div { width: 100px; height:100px; background: red; color: white; -webkit-animation:mymove 2s infinite linearalternate;/* Chrome,Safari, Opera */ animation: mymove 2s infinite linearalternate; } /* Chrome,Safari, Opera */ @-webkit-keyframesmymove { to {-webkit-transform:rotateY(180deg);} } @keyframesmymove { to {transform: rotateY(180deg);} } </style> </head> <body> <p>Check/uncheck the checkbox to change the backface-visibilityofthe animated DIV element:</p> <div id="myDIV"> <h1>Hello</h1> </div> <input type="checkbox" onclick="myFunction(this)" checked>backface-visibility <script> functionmyFunction(x) { if(x.checked=== true) { document.getElementById("myDIV").style.WebkitBackfaceVisibility="visible";//Code for Chrome, Safari, Opera document.getElementById("myDIV").style.backfaceVisibility="visible"; } else { document.getElementById("myDIV").style.WebkitBackfaceVisibility="hidden";// Code for Chrome,Safari, Opera document.getElementById("myDIV").style.backfaceVisibility="hidden"; } } </script> <p><strong>Note:</strong> The backface-visibilityandbackfaceVisibilitypropertiesare notsupported in InternetExplorer9 and earlierversions.</p>
  • 6. </body> </html> <!DOCTYPE html>border <html> <body> <div id="myDiv">Thisisa div element.</div> <br> <button type="button" onclick="myFunction()">Setborder</button> <script> functionmyFunction() { document.getElementById("myDiv").style.border="thicksolid #0000FF"; } </script> </body> </html> document.getElementById("myDiv").style.borderBottom="thicksolid#0000FF"; document.getElementById("myDiv").style.borderBottomColor="red"; <!DOCTYPE html>borderBottomLeftRadius <html> <head> <style> #myDIV { border: 1px solid black; width: 300px; height:300px; } </style> </head> <body> <p>Click the "Try it" button to change the border-bottom-left-radiuspropertyofthe DIV element:</p> <button onclick="myFunction()">Tryit</button> <div id="myDIV"> <h1>Hello</h1> </div> <script> functionmyFunction() { document.getElementById("myDIV").style.borderBottomLeftRadius="25px"; document.getElementById("myDIV").style.borderBottomLeftRadius="25px";
  • 7. } </script> </body> </html> <!DOCTYPE html>borderBottomStyle <html> <body> <div id="myDiv">Thisisa div.</div> <br> <button type="button" onclick="myFunction()">Setsolidbottomborder</button> <script> functionmyFunction() { document.getElementById("myDiv").style.borderBottomStyle="solid"; } </script> </body> </html> <!DOCTYPE html>borderBottomWidth <html> <head> <style> #myDiv { border-style:solid; } </style> </head> <body> <div id="myDiv">Thisisa div element.</div> <br> <button type="button" onclick="myFunction()">Change widthofthe bottom border</button> <script> functionmyFunction() { document.getElementById("myDiv").style.borderBottomWidth="10px"; } </script> </body> </html>
  • 8. <!DOCTYPE html>borderCollapse <html> <body> <table id="myTable" border="1"> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$150</td> </tr> </table> <br> <button type="button" onclick="myFunction()">Collapseborder</button> <script> functionmyFunction() { document.getElementById("myTable").style.borderCollapse ="collapse"; } </script> </body> </html> <!DOCTYPE html>borderColor <html> <head> <style> #myDiv { border: thick solidblue; } </style> </head> <body> <div id="myDiv">Thisisa div.</div> <br> <button type="button" onclick="myFunction()">Change colorofthe four borders</button> <script> functionmyFunction() { document.getElementById("myDiv").style.borderColor="red"; } </script> </body> </html>
  • 9. <!DOCTYPE html>borderColor <html> <head> <style> #myDIV { border: 15px solidtransparent; width: 250px; padding: 10px 20px; -webkit-border-image:url(border.png) 3030 stretch; /* Safari 5 */ -o-border-image:url(border.png) 3030 stretch; /* Opera 12 */ border-image:url(border.png) 30 30 stretch; } </style> </head> <body> <p>Click the "Try it" button to change the border-image propertyof the DIV element:</p> <button onclick="myFunction()">Tryit</button> <div id="myDIV"> <h1>Hello</h1> </div> <script> functionmyFunction() { document.getElementById("myDIV").style.WebkitBorderImage ="url(border.png) 30 30 round"; /* Code for Safari 5 */ document.getElementById("myDIV").style.OBorderImage ="url(border.png) 30 30 round"; /* Code for Opera 12 */ document.getElementById("myDIV").style.borderImage ="url(border.png) 3030 round"; } </script> </body> </html> <!DOCTYPE html>boxShadow <html> <head> <style> #myDIV { position:absolute; width: 100px; height:100px; background-color: coral; color: white; } </style> </head>
  • 10. <body> <p>Click the "Try it" button to setthe boxShadow property of the DIV element:</p> <button onclick="myFunction()">Tryit</button> <div id="myDIV"> <h1>myDIV</h1> </div> <script> functionmyFunction() { document.getElementById("myDIV").style.boxShadow="10px 20px 30px lightblue"; } </script> </body> </html> <!DOCTYPE html>display <html> <head> <style> #myDIV { width: 500px; height:500px; background-color: lightblue; } </style> </head> <body> <p>Click the "Try it" button to setthe displayproperty of the DIV elementto"none":</p> <button onclick="myFunction()">Tryit</button> <div id="myDIV"> This is my DIV element. </div> <p><b>Note:</b> The elementwill nottake up any space whenthe displayproperty set to "none".</p> <script> functionmyFunction() { document.getElementById("myDIV").style.display="none"; } </script> </body> </html>
  • 11. <!DOCTYPE html>Style cursor Property <html> <body> <p id="myP">Mouse overthis textbefore and after you have clickedthe button below!</p> <button type="button" onclick="myFunction()">Change cursor</button> <script> functionmyFunction() { document.getElementById("myP").style.cursor= "pointer"; } </script> </body> </html> <!DOCTYPE html>font <html> <body> <p id="myP">Thisis a paragraph.</p> <button type="button" onclick="myFunction()">Setfont</button> <script> functionmyFunction() { document.getElementById("myP").style.font="italicbold 20px arial,serif"; } </script> </body> </html> document.getElementById("myP").style.fontFamily="Impact,Charcoal,sans-serif"; document.getElementById("myP").style.fontFamily="Impact,Charcoal,sans-serif"; document.getElementById("myP").style.fontSize ="xx-large"; document.getElementById("myP").style.fontStyle="italic"; document.getElementById("myP").style.fontVariant="small-caps"; document.getElementById("myBtn").style.height="50px"; document.getElementById("main".style.justifyContent="space-between"; document.getElementById("myBtn").style.left="100px"; document.getElementById("myP").style.letterSpacing="15px";
  • 12. document.getElementById("myDiv").style.lineHeight="3"; document.getElementById("myList").style.listStyle ="decimal inside"; document.getElementById("myList").style.listStyleImage="url('sqorange.gif')"; document.getElementById("myDiv").style.margin="50px 10px 20px 30px"; document.getElementById("myDiv").style.marginBottom="50px"; <!DOCTYPE html>overflow <html> <head> <style> #myDIV { border: 1px solid black; background-color: lightblue; width: 300px; height:210px; overflow:visible; } </style> </head> <body> <p>Click the "Try it" button to change the overflowproperty ofthe DIV element:</p> <button onclick="myFunction()">Tryit</button> <div id="myDIV"> Lorem ipsumdolor sit amet, consectetueradipiscingelit,seddiam nonummynibh euismodtincidunt ut laoreetdolore magna aliquam erat volutpat. Ut wisi enimad minimveniam,quis nostrud exerci type extra </div> <script> functionmyFunction() { document.getElementById("myDIV").style.overflow="scroll"; } </script> </body> </html> document.getElementById("myDIV").style.overflowX="scroll"; document.getElementById("myDIV").style.overflowX="scroll"; document.getElementById("myDiv").style.padding="50px 10px 20px 30px"; <!DOCTYPE html> Transform <html> <head> <style> #myDIV { margin: auto; border: 1px solid black;
  • 13. width: 200px; height:100px; background-color: coral; color: white; } </style> </head> <body> <p>Click the "Try it" button to rotate the DIV element:</p> <button onclick="myFunction()">Tryit</button> <div id="myDIV"> <h1>myDIV</h1> </div> <script> functionmyFunction() { // Code for Chrome, Safari, Opera document.getElementById("myDIV").style.WebkitTransform="rotate(20deg)"; // Code for IE9 document.getElementById("myDIV").style.msTransform="rotate(20deg)"; // Standard syntax document.getElementById("myDIV").style.transform="rotate(20deg)"; } </script> </body> </html> <!DOCTYPE html>transitionTimingFunction <html> <head> <style> #myDIV { border: 1px solid black; background-color: lightblue; width: 270px; height:200px; overflow:auto; -webkit-transition:all 2s; /* For Safari 3.1 to 6.0 */ transition: all 2s; } #myDIV:hover { background-color: coral; width: 570px; height:500px; padding: 100px;
  • 14. border-radius:50px; } </style> </head> <body> <p>Mouse overthe DIV elementand it will change,gradually, both in color and size!</p> <p>Click the "Try it" button and mouse over the DIV elementagain. The changes will now happen ina linearspeedcurve.</p> <button onclick="myFunction()">Tryit</button> <div id="myDIV"> <h1>myDIV</h1> </div> <script> functionmyFunction() { document.getElementById("myDIV").style.WebkitTransitionTimingFunction="linear";// Code for Safari 3.1 to 6.0 document.getElementById("myDIV").style.transitionTimingFunction ="linear"; // Standard syntax } </script> <p><strong>Note:</strong> The transitionTimingFunctionpropertyis supportedin InternetExplorer 10, Firefox,Opera,and Chrome.</p> <p>Safari supports an alternative,the WebkitTransitionTimingFunctionproperty.</p> </body> </html>