مكتبة أمثلة اكواد CSS

تحتوي مكتبة امثلة اكواد CSS على تمارين عديدة وشاملة تساعدك لفهم وتعلم تنسيق وترتيب صفحات الويب

مثال عن محدد عنصر Element selector:

<!--DOCTYPE html-->
	  <html>
		<head>
<style>
p {
  text-align: center;
  color: red;
} 
</style>
		</head>
		<body>

		  <p>Every paragraph will be affected by the style.</p>
		  <p id="para1">Me too!</p>
		  <p>And me!</p>

		</body>
	  </html>

مثال عن محدد id selector:

<!--DOCTYPE html-->
	  <html>
		<head>
<style>
#para1 {
  text-align: center;
  color: red;
}
</style>
		</head>
		<body>

		  <p id="para1">Hello World!</p>
		  <p>This paragraph is not affected by the style.</p>

		</body>
	  </html>

مثال عن محدد عنصر class selector:

<!--DOCTYPE html-->
	  <html>
		<head>
<style>
.center {
  text-align: center;
  color: red;
}
</style>
		</head>
		<body>

		  <h1 class="center">Red and center-aligned heading</h1>
		  <p class="center">Red and center-aligned paragraph.</p> 

		</body>
	  </html>

مثال عن المحدد العام universal selector:

<!--DOCTYPE html-->
	  <html>
		<head>
<style>
* {
  text-align: center;
  color: blue;
}
</style>
		</head>
		<body>

		  <h1>Hello world!</h1>

		  <p>Every element on the page will be affected by the style.</p>
		  <p id="para1">Me too!</p>
		  <p>And me!</p>

		</body>
	  </html>

مثال عن المحدد لمجموعة group selector:

<!--DOCTYPE html-->
	  <html>
		<head>
<style>
h1, h2, p {
  text-align: center;
  color: red;
}
</style>
		</head>
		<body>

		  <h1>Hello World!</h1>
		  <h2>Smaller heading!</h2>
		  <p>This is a paragraph.</p>

		</body>
	  </html>


مثال عن لون الخلفية:

<!--DOCTYPE html-->
		<html>
		  <body>

			<h1 style="background-color:DodgerBlue;">Hello World</h1>

			<p style="background-color:Tomato;">
			  Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
			  Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
			</p>

		  </body>
		</html>

مثال عن لون النص:

 

<!--DOCTYPE html-->
		<html>
		  <body>

			<h3 style="color:Tomato;">Hello World</h3>

			<p style="color:DodgerBlue;">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>

			<p style="color:MediumSeaGreen;">Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p>

		  </body>
		</html>

مثال عن لون حدود النص:

 

<!--DOCTYPE html-->
		<html>
		  <body>

			<h1 style="border: 2px solid Tomato;">Hello World</h1>

			<h1 style="border: 2px solid DodgerBlue;">Hello World</h1>

			<h1 style="border: 2px solid Violet;">Hello World</h1>

		  </body>
		</html>

مثال عن طريقة تحديد الألوان بطريقتين:

 

<!--DOCTYPE html-->
		<html>
		<body>

		<h1 style="background-color:rgb(255, 0, 0);">rgb(255, 0, 0)</h1>
		<h1 style="background-color:rgb(0, 0, 255);">rgb(0, 0, 255)</h1>
		<h1 style="background-color:rgb(60, 179, 113);">rgb(60, 179, 113)</h1>
		<h1 style="background-color:rgb(238, 130, 238);">rgb(238, 130, 238)</h1>
		<h1 style="background-color:rgb(255, 165, 0);">rgb(255, 165, 0)</h1>
		<h1 style="background-color:rgb(106, 90, 205);">rgb(106, 90, 205)</h1>

		<p>In HTML, you can specify colors using RGB values.</p>
		<!--DOCTYPE html-->
		<html>
		  <body>

			<h1 style="background-color:#000000;">#000000</h1>
			<h1 style="background-color:#3c3c3c;">#3c3c3c</h1>
			<h1 style="background-color:#787878;">#787878</h1>
			<h1 style="background-color:#b4b4b4;">#b4b4b4</h1>
			<h1 style="background-color:#f0f0f0;">#f0f0f0</h1>
			<h1 style="background-color:#ffffff;">#ffffff</h1>

			<p>By using equal values for red, green, and blue, you will get different shades of gray.</p>

		  </body>
		</html>

 



مثال عن تغيير لون الخلفية لصفحة HTML:

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
body {
  background-color: lightblue;
}
</style>
		  </head>
		  <body>

			<h1>Hello World!</h1>

			<p>This page has a light blue background color!</p>

		  </body>
		</html>

مثال عن تغيير لون الخلفية لعنصر محدد:

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
h1 {
  background-color: green;
}

div {
  background-color: lightblue;
}

p {
  background-color: yellow;
}
</style>
		  </head>
		  <body>

			<h1>CSS background-color example!</h1>
			<div>
			  This is a text inside a div element.
			  <p>This paragraph has its own background color.</p>
			  We are still in the div element.
			</div>

		  </body>
		</html>

مثال عن وضع صورة كخلفية:

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
body {
  background-image: url("https://www.w3schools.com/css/paper.gif");
}
</style>
		  </head>
		  <body>

			<h1>Hello World!</h1>

			<p>This page has an image as the background!</p>

		  </body>
		</html>

مثال عن وضع صورة ثابتة كخلفية:

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
body {
  background-image: url("https://www.w3schools.com/css/img_tree.png");
  background-repeat: no-repeat;
  background-position: right top;
  margin-right: 200px;
  background-attachment: fixed;
}
</style>
		  </head>
		  <body>

			<h1>The background-attachment Property</h1>

			<p>The background-attachment property specifies whether the background image should scroll or be fixed (will not scroll with the rest of the page).</p>

			<p><strong>Tip:</strong> If you do not see any scrollbars, try to resize the browser window.</p>

			<p>The background-image is fixed. Try to scroll down the page.</p>
			<p>The background-image is fixed. Try to scroll down the page.</p>
			<p>The background-image is fixed. Try to scroll down the page.</p>
			<p>The background-image is fixed. Try to scroll down the page.</p>
			<p>The background-image is fixed. Try to scroll down the page.</p>
			<p>The background-image is fixed. Try to scroll down the page.</p>
			<p>The background-image is fixed. Try to scroll down the page.</p>
			<p>The background-image is fixed. Try to scroll down the page.</p>
			<p>The background-image is fixed. Try to scroll down the page.</p>
			<p>The background-image is fixed. Try to scroll down the page.</p>
			<p>The background-image is fixed. Try to scroll down the page.</p>
			<p>The background-image is fixed. Try to scroll down the page.</p>
			<p>The background-image is fixed. Try to scroll down the page.</p>
			<p>The background-image is fixed. Try to scroll down the page.</p>
			<p>The background-image is fixed. Try to scroll down the page.</p>
			<p>The background-image is fixed. Try to scroll down the page.</p>
			<p>The background-image is fixed. Try to scroll down the page.</p>
			<p>The background-image is fixed. Try to scroll down the page.</p>
			<p>The background-image is fixed. Try to scroll down the page.</p>
			<p>The background-image is fixed. Try to scroll down the page.</p>
			<p>The background-image is fixed. Try to scroll down the page.</p>
			<p>The background-image is fixed. Try to scroll down the page.</p>

		  </body>
		</html>


مثال عن تحديد عرض الحدودborder width :

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
p.one {
  border-style: solid;
  border-width: 5px;
}

p.two {
  border-style: solid;
  border-width: medium;
}

p.three {
  border-style: dotted;
  border-width: 2px;
}

p.four {
  border-style: dotted;
  border-width: thick;
}

p.five {
  border-style: double;
  border-width: 15px;
}

p.six {
  border-style: double;
  border-width: thick;
}
</style>
		  </head>
		  <body>

			<h2>The border-width Property</h2>
			<p>This property specifies the width of the four borders:</p>

			<p class="one">Some text.</p>
			<p class="two">Some text.</p>
			<p class="three">Some text.</p>
			<p class="four">Some text.</p>
			<p class="five">Some text.</p>
			<p class="six">Some text.</p>

			<p><b>Note:</b> The "border-width" property does not work if it is used alone. 
			  Always specify the "border-style" property to set the borders first.</p>

		  </body>
		</html>

 

 

 

مثال عن تحديد لون الحدود border color:

 

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
p.one {
  border-style: solid;
  border-color: #0000ff;
}

p.two {
  border-style: solid;
  border-color: #ff0000 #0000ff;
}

p.three {
  border-style: solid;
  border-color: #ff0000 #00ff00 #0000ff;
}

p.four {
  border-style: solid;
  border-color: #ff0000 #00ff00 #0000ff rgb(250,0,255);
}
</style>
		  </head>
		  <body>

			<p class="one">One-colored border!</p>
			<p class="two">Two-colored border!</p>
			<p class="three">Three-colored border!</p>
			<p class="four">Four-colored border!</p>
			<p><b>Note:</b> The "border-color" property does not work if it is used alone. Use the "border-style" property to set the borders first.</p>

		  </body>
		</html>

 

مثال عن تحديد نمط الحدود border style:

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
p.dotted {border-style: dotted;}
p.dashed {border-style: dashed;}
p.solid {border-style: solid;}
p.double {border-style: double;}
p.groove {border-style: groove;}
p.ridge {border-style: ridge;}
p.inset {border-style: inset;}
p.outset {border-style: outset;}
p.none {border-style: none;}
p.hidden {border-style: hidden;}
p.mix {border-style: dotted dashed solid double;}
</style>
		  </head>
		  <body>

			<h2>The border-style Property</h2>
			<p>This property specifies what kind of border to display:</p>

			<p class="dotted">A dotted border.</p>
			<p class="dashed">A dashed border.</p>
			<p class="solid">A solid border.</p>
			<p class="double">A double border.</p>
			<p class="groove">A groove border.</p>
			<p class="ridge">A ridge border.</p>
			<p class="inset">An inset border.</p>
			<p class="outset">An outset border.</p>
			<p class="none">No border.</p>
			<p class="hidden">A hidden border.</p>
			<p class="mix">A mixed border.</p>

		  </body>
		</html>

مثال عن تحديد كل خصائص الحدود border:

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
p.one {
  border-style: dotted solid dashed double;
}

p.two {
  border-style: dotted solid dashed;
}

p.three {
  border-style: dotted solid;
}

p.four {
  border-style: dotted;
}
</style>
		  </head>
		  <body>

			<p class="one">This is some text in a paragraph.</p>
			<p class="two">This is some text in a paragraph.</p>
			<p class="three">This is some text in a paragraph.</p>
			<p class="four">This is some text in a paragraph.</p>

		  </body>
		</html>


مثال عن تحديد الهامش لعنصر من كل الاتجاهات:

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
div {
  border: 1px solid black;
  margin-top: 100px;
  margin-bottom: 100px;
  margin-right: 150px;
  margin-left: 80px;
  background-color: lightblue;
}
</style>
		  </head>
		  <body>

			<h2>Using individual margin properties</h2>

			<div>This div element has a top margin of 100px, a right margin of 150px, a bottom margin of 100px, and a left margin of 80px.</div>

		  </body>
		</html>

مثال عن تحديد الهامش لعنصر باستخدام اربع قيم:

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
div {
  border: 1px solid black;
  margin: 25px 50px 75px 100px;
  background-color: lightblue;
}
</style>
		  </head>
		  <body>

			<h2>The margin shorthand property - 4 values</h2>

			<div>This div element has a top margin of 25px, a right margin of 50px, a bottom margin of 75px, and a left margin of 100px.</div>

			<hr>

		  </body>
		</html>

 

مثال عن تحديد الهامش لعنصر (توسيط العنصر) :

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
div {
  width:300px;
  margin: auto;
  border: 1px solid red;
}
</style>
		  </head>
		  <body>

			<h2>Use of margin:auto</h2>
			<p>You can set the margin property to auto to horizontally center the element within its container. The element will then take up the specified width, and the remaining space will be split equally between the left and right margins:</p>

			<div>
			  This div will be horizontally centered because it has margin: auto;
			</div>

		  </body>
		</html>


مثال عن تحديد الهامش لعنصر من كل الاتجاهات:

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
div {
  border: 1px solid black;
  background-color: lightblue;
  padding-top: 50px;
  padding-right: 30px;
  padding-bottom: 50px;
  padding-left: 80px;
}
</style>
		  </head>
		  <body>

			<h2>Using individual padding properties</h2>

			<div>This div element has a top padding of 50px, a right padding of 30px, a bottom padding of 50px, and a left padding of 80px.</div>

		  </body>
		</html>

مثال عن تحديد الهامش لعنصر باستخدام اربع قيم: 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
div {
  border: 1px solid black;
  padding: 25px 50px 75px 100px;
  background-color: lightblue;
}
</style>
		  </head>
		  <body>

			<h2>The padding shorthand property - 4 values</h2>

			<div>This div element has a top padding of 25px, a right padding of 50px, a bottom padding of 75px, and a left padding of 100px.</div>

		  </body>
		</html>

مثال عن تحديد الهامش لعنصر (box-sizing) : 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
div.ex1 {
  width: 300px;
  background-color: yellow;
}

div.ex2 {
  width: 300px;
  padding: 25px;
  background-color: lightblue;
}
</style>
		  </head>
		  <body>

			<h2>Padding and element width</h2>

			<div class="ex1">This div is 300px wide.</div>
			<br>

			<div class="ex2">The width of this div is 350px, even though it is defined as 300px in the CSS.</div>

		  </body>
		</html>


مثال عن تغيير لون لنص: 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
body {
  color: blue;
}

h1 {
  color: green;
}
</style>
		  </head>
		  <body>

			<h1>This is heading 1</h1>
			<p>This is an ordinary paragraph. Notice that this text is blue. The default text color for a page is defined in the body selector.</p>
			<p>Another paragraph.</p>

		  </body>
		</html>

مثال عن محاذاة النص:

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
h1 {
  text-align: center;
}

h2 {
  text-align: left;
}

h3 {
  text-align: right;
}
</style>
		  </head>
		  <body>

			<h1>Heading 1 (center)</h1>
			<h2>Heading 2 (left)</h2>
			<h3>Heading 3 (right)</h3>

			<p>The three headings above are aligned center, left and right.</p>

		  </body>
		</html>

مثال عن تزيين النص:

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
h1 {
  text-decoration: overline;
}

h2 {
  text-decoration: line-through;
}

h3 {
  text-decoration: underline;
}
</style>
		  </head>
		  <body>

			<h1>This is heading 1</h1>
			<h2>This is heading 2</h2>
			<h3>This is heading 3</h3>

		  </body>
		</html>

مثال عن زيادة الفراغات بين الكلمات: 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
h1 {
  word-spacing: 10px;
}

h2 {
  word-spacing: -5px;
}
</style>
		  </head>
		  <body>

			<h1>This is heading 1</h1>
			<h2>This is heading 2</h2>

		  </body>
		</html>


مثال عن تغيير نوع الخط لنص: 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
.p1 {
  font-family: "Times New Roman", Times, serif;
}

.p2 {
  font-family: Arial, Helvetica, sans-serif;
}

.p3 {
  font-family: "Lucida Console", "Courier New", monospace;
}
</style>
		  </head>
		  <body>

			<h1>CSS font-family</h1>
			<p class="p1">This is a paragraph, shown in the Times New Roman font.</p>
			<p class="p2">This is a paragraph, shown in the Arial font.</p>
			<p class="p3">This is a paragraph, shown in the Lucida Console font.</p>

		  </body>
		</html>

مثال عن تغيير حجم الخط لنص:

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
h1 {
  font-size: 250%;
}

h2 {
  font-size: 200%;
}

p {
  font-size: 100%;
}
</style>
		  </head>
		  <body>

			<h1>This is heading 1</h1>
			<h2>This is heading 2</h2>
			<p>This is a paragraph.</p>

		  </body>
		</html>

مثال عن تغيير نمط الخط لنص:

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
p.normal {
  font-style: normal;
}

p.italic {
  font-style: italic;
}

p.oblique {
  font-style: oblique;
}
</style>
		  </head>
		  <body>

			<p class="normal">This is a paragraph in normal style.</p>
			<p class="italic">This is a paragraph in italic style.</p>
			<p class="oblique">This is a paragraph in oblique style.</p>

		  </body>
		</html>

مثال عن تغيير كل خصائص الخط لنص:

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
p.a {
  font: 20px Arial, sans-serif;
}

p.b {
  font: italic bold 12px/30px Georgia, serif;
}
</style>
		  </head>
		  <body>

			<h1>The font Property</h1>

			<p class="a">This is a paragraph. The font size is set to 20 pixels, and the font family is Arial.</p>

			<p class="b">This is a paragraph. The font is set to italic and bold, the font size is set to 12 pixels, the line height is set to 30 pixels, and the font family is Georgia.</p>

		  </body>
		</html>


مثال عن ايقونات Google: 

 

<!--DOCTYPE html-->
		<html>
		  <head>
			<title>Google Icons</title>
			<meta name="viewport" content="width=device-width, initial-scale=1">
			<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
		  </head>
		  <body>

			<p>Some Google icons:</p>
			<i class="material-icons">cloud</i>
			<i class="material-icons">favorite</i>
			<i class="material-icons">attachment</i>
			<i class="material-icons">computer</i>
			<i class="material-icons">traffic</i>
			<br><br>

			<p>Styled Google icons (size and color):</p>
			<i class="material-icons" style="font-size:24px;">cloud</i>
			<i class="material-icons" style="font-size:36px;">cloud</i>
			<i class="material-icons" style="font-size:48px;color:red;">cloud</i>
			<i class="material-icons" style="font-size:60px;color:lightblue;">cloud</i>

		  </body>
		</html>

 

مثال عن ايقونات Bootstrap: 

 

<!--DOCTYPE html-->
		<html>
		  <head>
			<title>Bootstrap Icons</title>
			<meta name="viewport" content="width=device-width, initial-scale=1">
			<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
		  </head>
		  <body class="container">

			<p>Some Bootstrap icons:</p>
			<i class="glyphicon glyphicon-cloud"></i>
			<i class="glyphicon glyphicon-remove"></i>
			<i class="glyphicon glyphicon-user"></i>
			<i class="glyphicon glyphicon-envelope"></i>
			<i class="glyphicon glyphicon-thumbs-up"></i>
			<br><br>

			<p>Styled Bootstrap icons (size and color):</p>
			<i class="glyphicon glyphicon-cloud" style="font-size:24px;"></i>
			<i class="glyphicon glyphicon-cloud" style="font-size:36px;"></i>
			<i class="glyphicon glyphicon-cloud" style="font-size:48px;color:red;"></i>
			<i class="glyphicon glyphicon-cloud" style="font-size:60px;color:lightblue;"></i>

		  </body>
		</html>


مثال عن تغيير لون الرابط قبل و بعد زيارته:

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
/* unvisited link */
a:link {
  color: red;
}

/* visited link */
a:visited {
  color: green;
}

/* mouse over link */
a:hover {
  color: hotpink;
}

/* selected link */
a:active {
  color: blue;
}
</style>
		  </head>
		  <body>

			<h2>CSS Links</h2>
			<p><b><a href="https://daafoor.com/" target="_blank">This is a link</a></b></p>
			<p><b>Note:</b> a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective.</p>
			<p><b>Note:</b> a:active MUST come after a:hover in the CSS definition in order to be effective.</p>

		  </body>
		</html>

مثال عن تغيير لون الخلفية للرابط قبل و بعد زيارته:

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
a:link {
  background-color: yellow;
}

a:visited {
  background-color: cyan;
}

a:hover {
  background-color: lightgreen;
}

a:active {
  background-color: hotpink;
} 
</style>
		  </head>
		  <body>

			<h2>CSS Links</h2>
			<p><b><a href="https://daafoor.com/" target="_blank">This is a link</a></b></p>
			<p><b>Note:</b> a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective.</p>
			<p><b>Note:</b> a:active MUST come after a:hover in the CSS definition in order to be effective.</p>

		  </body>
		</html>

مثال عن تغييرنمط المؤشر على الرابط قبل و بعد زيارته:

 

 

<!--DOCTYPE html-->
		<html>
		  <body>
			<p>Mouse over the words to change the cursor.</p>
			<span style="cursor:auto">auto</span><br>
			<span style="cursor:crosshair">crosshair</span><br>
			<span style="cursor:default">default</span><br>
			<span style="cursor:e-resize">e-resize</span><br>
			<span style="cursor:help">help</span><br>
			<span style="cursor:move">move</span><br>
			<span style="cursor:n-resize">n-resize</span><br>
			<span style="cursor:ne-resize">ne-resize</span><br>
			<span style="cursor:nw-resize">nw-resize</span><br>
			<span style="cursor:pointer">pointer</span><br>
			<span style="cursor:progress">progress</span><br>
			<span style="cursor:s-resize">s-resize</span><br>
			<span style="cursor:se-resize">se-resize</span><br>
			<span style="cursor:sw-resize">sw-resize</span><br>
			<span style="cursor:text">text</span><br>
			<span style="cursor:w-resize">w-resize</span><br>
			<span style="cursor:wait">wait</span><br>
		  </body>
		</html>

مثال عن تغيير الماركر للقوائم غير المرتبة: 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
ul.a {list-style-type: circle;}
ul.b {list-style-type: disc;}
ul.c {list-style-type: square;}

ol.d {list-style-type: armenian;}
ol.e {list-style-type: cjk-ideographic;}
ol.f {list-style-type: decimal;}
ol.g {list-style-type: decimal-leading-zero;}
ol.h {list-style-type: georgian;}
ol.i {list-style-type: hebrew;}
ol.j {list-style-type: hiragana;}
ol.k {list-style-type: hiragana-iroha;}
ol.l {list-style-type: katakana;}
ol.m {list-style-type: katakana-iroha;}
ol.n {list-style-type: lower-alpha;}
ol.o {list-style-type: lower-greek;}
ol.p {list-style-type: lower-latin;}
ol.q {list-style-type: lower-roman;}
ol.r {list-style-type: upper-alpha;}
ol.s {list-style-type: upper-latin;}
ol.t {list-style-type: upper-roman;}
ol.u {list-style-type: none;}
ol.v {list-style-type: inherit;}
</style>
		  </head>
		  <body>

			<ul class="a">
			  <li>Circle type</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ul>

			<ul class="b">
			  <li>Disc type</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ul>

			<ul class="c">
			  <li>Square type</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ul>

			<ol class="d">
			  <li>Armenian type</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ol>

			<ol class="e">
			  <li>Cjk-ideographic type</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ol>

			<ol class="f">
			  <li>Decimal type</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ol>

			<ol class="g">
			  <li>Decimal-leading-zero type</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ol>

			<ol class="h">
			  <li>Georgian type</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ol>

			<ol class="i">
			  <li>Hebrew type</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ol>

			<ol class="j">
			  <li>Hiragana type</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ol>

			<ol class="k">
			  <li>Hiragana-iroha type</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ol>

			<ol class="l">
			  <li>Katakana type</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ol>

			<ol class="m">
			  <li>Katakana-iroha type</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ol>

			<ol class="n">
			  <li>Lower-alpha type</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ol>

			<ol class="o">
			  <li>Lower-greek type</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ol>

			<ol class="p">
			  <li>Lower-latin type</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ol>

			<ol class="q">
			  <li>Lower-roman type</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ol>

			<ol class="r">
			  <li>Upper-alpha type</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ol>

			<ol class="s">
			  <li>Upper-latin type</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ol>

			<ol class="t">
			  <li>Upper-roman type</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ol>

			<ol class="u">
			  <li>None type</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ol>

			<ol class="v">
			  <li>inherit type</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ol>

		  </body>
		</html>

 

مثال عن تغيير الماركر للقوائم (صورة): 

 

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
ul {
  list-style-image: url('https://www.w3schools.com/css/sqpurple.gif');
}
</style>
		  </head>
		  <body>

			<h2>CSS Lists</h2>
			<p>The list-style-image property specifies an image as the list item marker:</p>

			<ul>
			  <li>Coffee</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ul>

		  </body>
		</html>

مثال عن تغيير لون ونمط القوائم:

 

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
ol {
  background: #ff9999;
  padding: 20px;
}

ul {
  background: #3399ff;
  padding: 20px;
}

ol li {
  background: #ffe5e5;
  padding: 5px;
  margin-left: 35px;
}

ul li {
  background: #cce5ff;
  margin: 5px;
}
</style>
		  </head>
		  <body>

			<h1>Styling Lists With Colors:</h1>

			<ol>
			  <li>Coffee</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ol>

			<ul>
			  <li>Coffee</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ul>

		  </body>
		</html>

مثال عن وضع حدودد للقوائم: 

 

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
ul {
  list-style-type: none;
  padding: 0;
  border: 1px solid #ddd;
}

ul li {
  padding: 8px 16px;
  border-bottom: 1px solid #ddd;
}

ul li:last-child {
  border-bottom: none
}
</style>
		  </head>
		  <body>

			<p>Full-width bordered list:</p>
			<ul>
			  <li>Coffee</li>
			  <li>Tea</li>
			  <li>Coca Cola</li>
			</ul>

		  </body>
		</html>


مثال عن جدول مخطط: 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
table {
  border-collapse: collapse;
  width: 100%;
}

th, td {
  text-align: left;
  padding: 8px;
}

tr:nth-child(even) {background-color: #f2f2f2;}
</style>
		  </head>
		  <body>

			<h2>Striped Table</h2>
			<p>For zebra-striped tables, use the nth-child() selector and add a background-color to all even (or odd) table rows:</p>

			<table>
			  <tr>
				<th>First Name</th>
				<th>Last Name</th>
				<th>Points</th>
			  </tr>
			  <tr>
				<td>Peter</td>
				<td>Griffin</td>
				<td>$100</td>
			  </tr>
			  <tr>
				<td>Lois</td>
				<td>Griffin</td>
				<td>$150</td>
			  </tr>
			  <tr>
				<td>Joe</td>
				<td>Swanson</td>
				<td>$300</td>
			  </tr>
			  <tr>
				<td>Cleveland</td>
				<td>Brown</td>
				<td>$250</td>
			  </tr>
			</table>

		  </body>
		</html>

 

مثال عن جدول يتغير نمطه عند وضع مؤشر الماوس عليه: 

 

 

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
table {
  border-collapse: collapse;
  width: 100%;
}

th, td {
  padding: 8px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

tr:hover {background-color:#f5f5f5;}
</style>
		  </head>
		  <body>

			<h2>Hoverable Table</h2>
			<p>Move the mouse over the table rows to see the effect.</p>

			<table>
			  <tr>
				<th>First Name</th>
				<th>Last Name</th>
				<th>Points</th>
			  </tr>
			  <tr>
				<td>Peter</td>
				<td>Griffin</td>
				<td>$100</td>
			  </tr>
			  <tr>
				<td>Lois</td>
				<td>Griffin</td>
				<td>$150</td>
			  </tr>
			  <tr>
				<td>Joe</td>
				<td>Swanson</td>
				<td>$300</td>
			  </tr>
			  <tr>
				<td>Cleveland</td>
				<td>Brown</td>
				<td>$250</td>
			  </tr>
			</table>

		  </body>
		</html>

 

مثال عن جدول متجاوب: 

 

 

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
table {
  border-collapse: collapse;
  width: 100%;
}

th, td {
  text-align: left;
  padding: 8px;
}

tr:nth-child(even) {background-color: #f2f2f2;}
</style>
		  </head>
		  <body>

			<h2>Responsive Table</h2>
			<p>A responsive table will display a horizontal scroll bar if the screen is too 
			  small to display the full content. Resize the browser window to see the effect:</p>
			<p>To create a responsive table, add a container element (like div) with <strong>overflow-x:auto</strong> around the table element:</p>

			<div style="overflow-x:auto;">
			  <table>
				<tr>
				  <th>First Name</th>
				  <th>Last Name</th>
				  <th>Points</th>
				  <th>Points</th>
				  <th>Points</th>
				  <th>Points</th>
				  <th>Points</th>
				  <th>Points</th>
				  <th>Points</th>
				  <th>Points</th>
				  <th>Points</th>
				  <th>Points</th>
				</tr>
				<tr>
				  <td>Jill</td>
				  <td>Smith</td>
				  <td>50</td>
				  <td>50</td>
				  <td>50</td>
				  <td>50</td>
				  <td>50</td>
				  <td>50</td>
				  <td>50</td>
				  <td>50</td>
				  <td>50</td>
				  <td>50</td>
				</tr>
				<tr>
				  <td>Eve</td>
				  <td>Jackson</td>
				  <td>94</td>
				  <td>94</td>
				  <td>94</td>
				  <td>94</td>
				  <td>94</td>
				  <td>94</td>
				  <td>94</td>
				  <td>94</td>
				  <td>94</td>
				  <td>94</td>
				</tr>
				<tr>
				  <td>Adam</td>
				  <td>Johnson</td>
				  <td>67</td>
				  <td>67</td>
				  <td>67</td>
				  <td>67</td>
				  <td>67</td>
				  <td>67</td>
				  <td>67</td>
				  <td>67</td>
				  <td>67</td>
				  <td>67</td>
				</tr>
			  </table>
			</div>

		  </body>
		</html>

مثال عن جدول بورصة: 

 

 

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
#customers {
  font-family: Arial, Helvetica, sans-serif;
  border-collapse: collapse;
  width: 100%;
}

#customers td, #customers th {
  border: 1px solid #ddd;
  padding: 8px;
}

#customers tr:nth-child(even){background-color: #f2f2f2;}

#customers tr:hover {background-color: #ddd;}

#customers th {
  padding-top: 12px;
  padding-bottom: 12px;
  text-align: left;
  background-color: #4CAF50;
  color: white;
}
</style>
		  </head>
		  <body>

			<table id="customers">
			  <tr>
				<th>Company</th>
				<th>Contact</th>
				<th>Country</th>
			  </tr>
			  <tr>
				<td>Alfreds Futterkiste</td>
				<td>Maria Anders</td>
				<td>Germany</td>
			  </tr>
			  <tr>
				<td>Berglunds snabbköp</td>
				<td>Christina Berglund</td>
				<td>Sweden</td>
			  </tr>
			  <tr>
				<td>Centro comercial Moctezuma</td>
				<td>Francisco Chang</td>
				<td>Mexico</td>
			  </tr>
			  <tr>
				<td>Ernst Handel</td>
				<td>Roland Mendel</td>
				<td>Austria</td>
			  </tr>
			  <tr>
				<td>Island Trading</td>
				<td>Helen Bennett</td>
				<td>UK</td>
			  </tr>
			  <tr>
				<td>Königlich Essen</td>
				<td>Philip Cramer</td>
				<td>Germany</td>
			  </tr>
			  <tr>
				<td>Laughing Bacchus Winecellars</td>
				<td>Yoshi Tannamuri</td>
				<td>Canada</td>
			  </tr>
			  <tr>
				<td>Magazzini Alimentari Riuniti</td>
				<td>Giovanni Rovelli</td>
				<td>Italy</td>
			  </tr>
			  <tr>
				<td>North/South</td>
				<td>Simon Crowther</td>
				<td>UK</td>
			  </tr>
			  <tr>
				<td>Paris spécialités</td>
				<td>Marie Bertrand</td>
				<td>France</td>
			  </tr>
			</table>

		  </body>
		</html>


مثال عن اخفاء/اظهار عنصر: 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
h1.hidden {
  visibility: hidden;
}
</style>
		  </head>
		  <body>

			<h1>This is a visible heading</h1>
			<h1 class="hidden">This is a hidden heading</h1>
			<p>Notice that the hidden heading still takes up space.</p>

		  </body>
		</html>

مثال عن تغيير طريقة عرض عنصر من بلوك إلى سطري:

 

 

 

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
p {
  display: inline;
}
</style>
		  </head>
		  <body>

			<p>These two paragraphs generates inline boxes, and it results in</p>

			<p>no distance between the two elements.</p>

		  </body>
		</html>

 

مثال عن تغيير طريقة عرض عنصر من سطري إلى بلوك:

 

 

 

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
span {
  display: block;
}
</style>
		  </head>
		  <body>

			<span>A display property with a value of "block" results in</span> <span>a line break between the two elements.</span>

		  </body>
		</html>

مثال عن تغيير طريقة عرض عنصر باستخدام جافاسكربت: 

 

 

 

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
#panel, .flip {
  font-size: 16px;
  padding: 10px;
  text-align: center;
  background-color: #4CAF50;
  color: white;
  border: solid 1px #a6d8a8;
  margin: auto;
}

#panel {
  display: none;
}
</style>
		  </head>
		  <body>

			<p class="flip" onclick="myFunction()">Click to show panel</p>

			<div id="panel">
			  <p>This panel contains a div element, which is hidden by default (display: none).</p>
			  <p>It is styled with CSS and we use JavaScript to show it (display: block).</p>
			  <p>How it works: Notice that the p element with class="flip" has an onclick attribute attached to it. When the user clicks on the p element, a function called myFunction() is executed, which changes the style of the div with id="panel" from display:none (hidden) to display:block (visible).</p>
			  <p>You will learn more about JavaScript in our JavaScript Tutorial.</p>
			</div>

<script>
function myFunction() {
  document.getElementById("panel").style.display = "block";
}
</script>

		  </body>
		</html>


مثال عن تغيير ستايل textarea: 

<!--DOCTYPE html-->
		<html>
		  <head>
<style> 
textarea {
  width: 100%;
  height: 150px;
  padding: 12px 20px;
  box-sizing: border-box;
  border: 2px solid #ccc;
  border-radius: 4px;
  background-color: #f8f8f8;
  font-size: 16px;
  resize: none;
}
</style>
		  </head>
		  <body>

			<p><strong>Tip:</strong> Use the resize property to prevent textareas from being resized (disable the "grabber" in the bottom right corner):</p>

			<form>
			  <textarea>Some text...</textarea>
			</form>

		  </body>
		</html>

مثال عن تغيير ستايل input button:

 

 

 

 

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style> 
input[type=button], input[type=submit], input[type=reset] {
  background-color: #4CAF50;
  border: none;
  color: white;
  padding: 16px 32px;
  text-decoration: none;
  margin: 4px 2px;
  cursor: pointer;
}
</style>
		  </head>
		  <body>

			<p>Styled input buttons.</p>

			<input type="button" value="Button">
			<input type="reset" value="Reset">
			<input type="submit" value="Submit">

		  </body>
		</html>

مثال عن input مع ايقونة : 

 

 

 

 

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style> 
input[type=text] {
  width: 100%;
  box-sizing: border-box;
  border: 2px solid #ccc;
  border-radius: 4px;
  font-size: 16px;
  background-color: white;
  background-image: url('searchicon.png');
  background-position: 10px 10px; 
  background-repeat: no-repeat;
  padding: 12px 20px 12px 40px;
}
</style>
		  </head>
		  <body>

			<p>Input with icon:</p>

			<form>
			  <input type="text" name="search" placeholder="Search..">
			</form>

		  </body>
		</html>

مثال عن Responsive form: 

 

 

 

 

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
* {
  box-sizing: border-box;
}

input[type=text], select, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
}

label {
  padding: 12px 12px 12px 0;
  display: inline-block;
}

input[type=submit] {
  background-color: #4CAF50;
  color: white;
  padding: 12px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  float: right;
}

input[type=submit]:hover {
  background-color: #45a049;
}

.container {
  border-radius: 5px;
  background-color: #f2f2f2;
  padding: 20px;
}

.col-25 {
  float: left;
  width: 25%;
  margin-top: 6px;
}

.col-75 {
  float: left;
  width: 75%;
  margin-top: 6px;
}

/* Clear floats after the columns */
.row:after {
  content: "";
  display: table;
  clear: both;
}

/* Responsive layout - when the screen is less than 600px wide, make the two columns stack on top of each other instead of next to each other */
@media screen and (max-width: 600px) {
  .col-25, .col-75, input[type=submit] {
    width: 100%;
    margin-top: 0;
  }
}
</style>
		  </head>
		  <body>

			<h2>Responsive Form</h2>
			<p>Resize the browser window to see the effect. When the screen is less than 600px wide, make the two columns stack on top of each other instead of next to each other.</p>

			<div class="container">
			  <form action="/action_page.php">
				<div class="row">
				  <div class="col-25">
					<label for="fname">First Name</label>
				  </div>
				  <div class="col-75">
					<input type="text" id="fname" name="firstname" placeholder="Your name..">
				  </div>
				</div>
				<div class="row">
				  <div class="col-25">
					<label for="lname">Last Name</label>
				  </div>
				  <div class="col-75">
					<input type="text" id="lname" name="lastname" placeholder="Your last name..">
				  </div>
				</div>
				<div class="row">
				  <div class="col-25">
					<label for="country">Country</label>
				  </div>
				  <div class="col-75">
					<select id="country" name="country">
					  <option value="australia">Australia</option>
					  <option value="canada">Canada</option>
					  <option value="usa">USA</option>
					</select>
				  </div>
				</div>
				<div class="row">
				  <div class="col-25">
					<label for="subject">Subject</label>
				  </div>
				  <div class="col-75">
					<textarea id="subject" name="subject" placeholder="Write something.." style="height:200px"></textarea>
				  </div>
				</div>
				<div class="row">
				  <input type="submit" value="Submit">
				</div>
			  </form>
			</div>

		  </body>
		</html>


 

مثال عن تغيير لون عنصر مع animation: 

 

 

 

 

 

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
div {
  width: 100px;
  height: 100px;
  background-color: red;
  animation-name: example;
  animation-duration: 4s;
}

@keyframes example {
  0%   {background-color: red;}
  25%  {background-color: yellow;}
  50%  {background-color: blue;}
  100% {background-color: green;}
}
</style>
		  </head>
		  <body>

			<p><b>Note:</b> This example does not work in Internet Explorer 9 and earlier versions.</p>

			<div></div>

		  </body>
		</html>

 

مثال عن تغيير لون وموقع عنصر مع animation: 

 

 

 

 

 

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style> 
div {
  width: 100px;
  height: 100px;
  background-color: red;
  position: relative;
  animation-name: example;
  animation-duration: 4s;
}

@keyframes example {
  0%   {background-color:red; left:0px; top:0px;}
  25%  {background-color:yellow; left:200px; top:0px;}
  50%  {background-color:blue; left:200px; top:200px;}
  75%  {background-color:green; left:0px; top:200px;}
  100% {background-color:red; left:0px; top:0px;}
}
</style>
		  </head>
		  <body>

			<p><b>Note:</b> This example does not work in Internet Explorer 9 and earlier versions.</p>

			<div></div>

		  </body>
		</html>

مثال عن تغيير لون وموقع عنصر مع animation دائم: 

 

 

 

 

 

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style> 
div {
  width: 100px;
  height: 100px;
  background-color: red;
  position: relative;
  animation-name: example;
  animation-duration: 4s;
  animation-iteration-count: infinite;
}

@keyframes example {
  0%   {background-color:red; left:0px; top:0px;}
  25%  {background-color:yellow; left:200px; top:0px;}
  50%  {background-color:blue; left:200px; top:200px;}
  75%  {background-color:green; left:0px; top:200px;}
  100% {background-color:red; left:0px; top:0px;}
}
</style>
		  </head>
		  <body>

			<p><b>Note:</b> This example does not work in Internet Explorer 9 and earlier versions.</p>

			<div></div>

		  </body>
		</html>




تعلم السي أس أس css3




مثال عن Rounded Image: 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
img {
  border-radius: 8px;
}
</style>
		  </head>
		  <body>

			<h2>Rounded Images</h2>
			<p>Use the border-radius property to create rounded images:</p>

			<img alt="Paris" height="300" src="https://www.w3schools.com/css/paris.jpg" width="300">

		  </body>
		</html>

 

مثال عن Circled Image: 

 

 

 

 

 

 

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
img {
  border-radius: 50%;
}
</style>
		  </head>
		  <body>

			<h2>Rounded Images</h2>
			<p>Use the border-radius property to create circled images:</p>

			<img alt="Paris" height="300" src="https://www.w3schools.com/css/paris.jpg" width="300">

		  </body>
		</html>

مثال عن Thumbnail Image: 

 

 

 

 

 

 

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
img {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 5px;
  width: 150px;
}
</style>
		  </head>
		  <body>

			<h2>Thumbnail Images</h2>
			<p>Use the border property to create thumbnail images:</p>

			<img alt="Paris" src="https://www.w3schools.com/css/paris.jpg" style="width:150px">

		  </body>
		</html>

مثال عن Responsive Image: 

 

 

 

 

 

 

 

 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
img {
  max-width: 100%;
  height: auto;
}
</style>
		  </head>
		  <body>

			<h2>Responsive Images</h2>
			<p>Responsive images will automatically adjust to fit the size of the screen.</p>
			<p>Resize the browser window to see the effect:</p>

			<img alt="Cinque Terre" height="300" src="https://www.w3schools.com/css/img_5terre_wide.jpg" width="1000">

		  </body>
		</html>

 

 مثال عن Advanced Image: 

<!--DOCTYPE html-->
		<html>
		  <head>
<style>
#myImg {
  border-radius: 5px;
  cursor: pointer;
  transition: 0.3s;
}

#myImg:hover {opacity: 0.7;}

/* The Modal (background) */
.modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1; /* Sit on top */
  padding-top: 100px; /* Location of the box */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgb(0,0,0); /* Fallback color */
  background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
}

/* Modal Content (image) */
.modal-content {
  margin: auto;
  display: block;
  width: 80%;
  max-width: 700px;
}

/* Caption of Modal Image */
#caption {
  margin: auto;
  display: block;
  width: 80%;
  max-width: 700px;
  text-align: center;
  color: #ccc;
  padding: 10px 0;
  height: 150px;
}

/* Add Animation */
.modal-content, #caption {  
  animation-name: zoom;
  animation-duration: 0.6s;
}

@keyframes zoom {
  from {transform: scale(0.1)} 
  to {transform: scale(1)}
}

/* The Close Button */
.close {
  position: absolute;
  top: 15px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
}

.close:hover,
.close:focus {
  color: #bbb;
  text-decoration: none;
  cursor: pointer;
}

/* 100% Image Width on Smaller Screens */
@media only screen and (max-width: 700px){
  .modal-content {
    width: 100%;
  }
}
</style>
		  </head>
		  <body>

			<h2>Image Modal</h2>
			<p>In this example, we use CSS to create a modal (dialog box) that is hidden by default.</p>
			<p>We use JavaScript to trigger the modal and to display the current image inside the modal when it is clicked on. Also note that we use the value from the image's "alt" attribute as an image caption text inside the modal.</p>
			<p>Don't worry if you do not understand the code right away. When you are done with CSS, go to our JavaScript Tutorial to learn more.</p>

			<img alt="Northern Lights, Norway" height="200" id="myImg" src="https://www.w3schools.com/css/img_lights.jpg" width="300">

			<!-- The Modal -->
			<div id="myModal" class="modal">
			  <span class="close">&times;</span>
			  <img class="modal-content" id="img01">
			  <div id="caption"></div>
			</div>

<script>
// Get the modal
var modal = document.getElementById('myModal');

// Get the image and insert it inside the modal - use its "alt" text as a caption
var img = document.getElementById('myImg');
var modalImg = document.getElementById("img01");
var captionText = document.getElementById("caption");
img.onclick = function(){
  modal.style.display = "block";
  modalImg.src = this.src;
  captionText.innerHTML = this.alt;
}

// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];

// When the user clicks on <span> (x), close the modal
span.onclick = function() { 
  modal.style.display = "none";
}
</script>

		  </body>
		</html>


كتب تعلم السي أس أس css3


تعليقات