CSS ﯼﺎﻫ ﺐﻟﺎﻗ


فهرست مطالب

    نمایش فهرست مطالب


CSS ﻥﺎﻣﺪﯿﭼ ﯼﺎﻫ ﺐﻟﺎﻗ

.ﻢﯾﺍ ﻩﺩﺮﮐ ﺩﺎﺠﯾﺍ CSS ﺎﺑ ﺍﺮﮕﺸﻨﮐﺍﻭ ﺕﺭﺎﺘﺳﺍ ﺐﻟﺎﻗ ﺪﻨﭼ ﺎﻣ

.ﺪﯿﻨﮐ ﻩﺩﺎﻔﺘﺳﺍ ﺩﻮﺧ ﯼﺎﻫ ﻩﮊﻭﺮﭘ ﻡﺎﻤﺗ ﺭﺩ ﻭ ﺪﯾﺭﺍﺬﮕﺑ ﮎﺍﺮﺘﺷﺍ ﻪﺑ ،ﺪﯿﻨﮐ ﻩﺮﯿﺧﺫ ،ﺪﯿﻫﺩ ﺮﯿﯿﻐ

:ﯽﻗﺭﻭﺎﭘ ﻭ ﯼﻭﺎﺴﻣ ﯼﺎﻫ ﻥﻮﺘﺳ ،ﮒﺮﺑﺮﺳ

Float ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ CSS ﺐﻟﺎﻗ

.ﺪﻧﺮﯿﮔ ﯽﻣ ﺭﺍﺮﻗ ﻢﻫ ﯼﻭﺭ ﺎﻫ ﻥﻮﺘﺳ ،ﺮﺘﮑﭼﻮﮐ ﯼﺎﻫ ﻪﺤﻔﺻ ﺭﺩ .ﻢﯾﺍ ﻩﺩﺮﮐ ﺩﺎﺠﯾﺍ ﯽﻗﺭﻭﺎﭘ ﮏﯾ ﻭ

.ﺪﯿﻨﯿﺒﺑ ﺍﺭ ﻮﮕﺨﺳﺎﭘ ﺮﺛﺍ ﺎﺗ ﺪﯿﻫﺩ ﺮﯿﯿﻐﺗ ﺍﺭ ﺮﮔﺭﻭﺮﻣ ﻩﺮﺠﻨﭘ ﻩﺯﺍﺪﻧﺍ

→ (ﺭﻭﺎﻨﺷ ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ) ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ

<!DOCTYPE html>
<html lang="en">
<head>
<title>CSS Template</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
  box-sizing: border-box;
}

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

/* Style the header */
.header {
  background-color: #f1f1f1;
  padding: 30px;
  text-align: center;
  font-size: 35px;
}

/* Create three equal columns that floats next to each other */
.column {
  float: left;
  width: 33.33%;
  padding: 10px;
  height: 300px; /* Should be removed. Only for demonstration */
}

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

/* Style the footer */
.footer {
  background-color: #f1f1f1;
  padding: 10px;
  text-align: center;
}

/* Responsive layout - makes the three columns stack on top of each other instead of next to each other */
@media (max-width: 600px) {
  .column {
    width: 100%;
  }
}
</style>
</head>
<body>

<h2>CSS Template using Float</h2>
<p>In this example, we have created a header, three equal columns and a footer. On smaller screens, the columns will stack on top of each other.</p>
<p>Resize the browser window to see the responsive effect.</p>

<div class="header">
  <h2>Header</h2>
</div>

<div class="row">
  <div class="column" style="background-color:#aaa;">Column</div>
  <div class="column" style="background-color:#bbb;">Column</div>
  <div class="column" style="background-color:#ccc;">Column</div>
</div>

<div class="footer">
  <p>Footer</p>
</div>

</body>
</html>


Flexbox ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ CSS ﺐﻟﺎﻗ

.ﺪﻧﺮﯿﮔ ﯽﻣ ﺭﺍﺮﻗ ﻢﻫ ﯼﻭﺭ ﺎﻫ ﻥﻮﺘﺳ ،ﺮﺘﮑﭼﻮﮐ ﯼﺎﻫ ﻪﺤﻔﺻ ﺭﺩ .ﻢﯾﺍ ﻩﺩﺮﮐ ﺩﺎﺠﯾﺍ ﯽﻗﺭﻭﺎﭘ ﮏﯾ ﻭ

.ﺪﯿﻨﯿﺒﺑ ﺍﺭ ﻮﮕﺨﺳﺎﭘ ﺮﺛﺍ ﺎﺗ ﺪﯿﻫﺩ ﺮﯿﯿﻐﺗ ﺍﺭ ﺮﮔﺭﻭﺮﻣ ﻩﺮﺠﻨﭘ ﻩﺯﺍﺪﻧﺍ

ﻪﺟﻮﺗ: Flexbox ﺭﺩ Internet Explorer 10 ﻪﺨﺴﻧ ﻭﯽﻤﻧ ﯽﻧﺎﺒﯿﺘﺸﭘ

→ (flexbox ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ) ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ

<!DOCTYPE html>
<html lang="en">
<head>
<title>CSS Template</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
  box-sizing: border-box;
}

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

/* Style the header */
.header {
  background-color: #f1f1f1;
  padding: 30px;
  text-align: center;
  font-size: 35px;
}

/* Container for flexboxes */
.row {
  display: -webkit-flex;
  display: flex;
}

/* Create three equal columns that sits next to each other */
.column {
  -webkit-flex: 1;
  -ms-flex: 1;
  flex: 1;
  padding: 10px;
  height: 300px; /* Should be removed. Only for demonstration */
}

/* Style the footer */
.footer {
  background-color: #f1f1f1;
  padding: 10px;
  text-align: center;
}

/* Responsive layout - makes the three columns stack on top of each other instead of next to each other */
@media (max-width: 600px) {
  .row {
    -webkit-flex-direction: column;
    flex-direction: column;
  }
}
</style>
</head>
<body>

<h2>CSS Template using Flexbox</h2>
<p>In this example, we have created a header, three equal columns and a footer. On smaller screens, the columns will stack on top of each other.</p>
<p>Resize the browser window to see the responsive effect.</p>
<p><strong>Note:</strong> Flexbox is not supported in Internet Explorer 10 eand earlier versions.</p>

<div class="header">
  <h2>Header</h2>
</div>

<div class="row">
  <div class="column" style="background-color:#aaa;">Column</div>
  <div class="column" style="background-color:#bbb;">Column</div>
  <div class="column" style="background-color:#ccc;">Column</div>
</div>

<div class="footer">
  <p>Footer</p>
</div>

</body>
</html>


Grid ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ CSS ﺐﻟﺎﻗ

.ﺪﻧﺮﯿﮔ ﯽﻣ ﺭﺍﺮﻗ ﻢﻫ ﯼﻭﺭ ﺎﻫ ﻥﻮﺘﺳ ،ﺮﺘﮑﭼﻮﮐ ﯼﺎﻫ ﻪﺤﻔﺻ ﺭﺩ .ﻢﯾﺍ ﻩﺩﺮﮐ ﺩﺎﺠﯾﺍ ﯽﻗﺭﻭﺎﭘ ﮏﯾ ﻭ

.ﺪﯿﻨﯿﺒﺑ ﺍﺭ ﻮﮕﺨﺳﺎﭘ ﺮﺛﺍ ﺎﺗ ﺪﯿﻫﺩ ﺮﯿﯿﻐﺗ ﺍﺭ ﺮﮔﺭﻭﺮﻣ ﻩﺮﺠﻨﭘ ﻩﺯﺍﺪﻧﺍ

ﻪﺟﻮﺗ: ﺡﺮﻃ ﻝﻭﮊﺎﻣﯼﺪﻨﺑ Grid ﺭﺩ Internet Explorer ﺎﯾ Edge 15

→ (ﻪﮑﺒﺷ ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ) ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ

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

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

/* Style the header */
.header {
  grid-area: header;
  background-color: #f1f1f1;
  padding: 30px;
  text-align: center;
  font-size: 35px;
}

/* The grid container */
.grid-container {
  display: grid;
  grid-template-areas: 
    'header header header header header header' 
    'left left middle middle right right' 
    'footer footer footer footer footer footer';
  /* grid-column-gap: 10px; - if you want gap between the columns */
} 

.left,
.middle,
.right {
  padding: 10px;
  height: 300px; /* Should be removed. Only for demonstration */
}

/* Style the left column */
.left {
  grid-area: left;
}

/* Style the middle column */
.middle {
  grid-area: middle;
}

/* Style the right column */
.right {
  grid-area: right;
}

/* Style the footer */
.footer {
  grid-area: footer;
  background-color: #f1f1f1;
  padding: 10px;
  text-align: center;
}

/* Responsive layout - makes the three columns stack on top of each other instead of next to each other */
@media (max-width: 600px) {
  .grid-container  {
    grid-template-areas: 
      'header header header header header header' 
      'left left left left left left' 
      'middle middle middle middle middle middle' 
      'right right right right right right' 
      'footer footer footer footer footer footer';
  }
}
</style>
</head>
<body>

<h2>CSS Template using Grid</h2>
<p>In this example, we have created a header, three equal columns and a footer. On smaller screens, the columns will stack on top of each other.</p>
<p>Resize the browser window to see the responsive effect.</p>
<p><strong>Note:</strong> The Grid Layout Module is not supported in Internet Explorer or Edge 15 eand earlier versions.</p>

<div class="grid-container">
  <div class="header">
    <h2>Header</h2>
  </div>
  
  <div class="left" style="background-color:#aaa;">Column</div>
  <div class="middle" style="background-color:#bbb;">Column</div>  
  <div class="right" style="background-color:#ccc;">Column</div>
  
  <div class="footer">
  <p>Footer</p>
  </div>
</div>

</body>
</html>


:ﯽﻗﺭﻭﺎﭘ ﻭ ﺮﺑﺍﺮﺑﺎﻧ ﯼﺎﻫﻥﻮﺘﺳ ،ﮒﺮﺑﺮﺳ

Float ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ CSS ﺐﻟﺎﻗ

.ﺪﻧﺮﯿﮔ ﯽﻣ ﺭﺍﺮﻗ ﻢﻫ ﯼﻭﺭ ﺎﻫ ﻥﻮﺘﺳ ،ﺮﺘﮑﭼﻮﮐ ﯼﺎﻫ ﻪﺤﻔﺻ ﺭﺩ .ﻢﯾﺍ ﻩﺩﺮﮐ ﺩﺎﺠﯾﺍ ﯽﻗﺭﻭﺎﭘ ﮏﯾ ﻭ

.ﺪﯿﻨﯿﺒﺑ ﺍﺭ ﻮﮕﺨﺳﺎﭘ ﺮﺛﺍ ﺎﺗ ﺪﯿﻫﺩ ﺮﯿﯿﻐﺗ ﺍﺭ ﺮﮔﺭﻭﺮﻣ ﻩﺮﺠﻨﭘ ﻩﺯﺍﺪﻧﺍ

→ (ﺭﻭﺎﻨﺷ ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ) ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ

<!DOCTYPE html>
<html lang="en">
<head>
<title>CSS Template</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
  box-sizing: border-box;
}

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

/* Style the header */
.header {
  background-color: #f1f1f1;
  padding: 30px;
  text-align: center;
  font-size: 35px;
}

/* Create three unequal columns that floats next to each other */
.column {
  float: left;
  padding: 10px;
  height: 300px; /* Should be removed. Only for demonstration */
}

/* Left and right column */
.column.side {
  width: 25%;
}

/* Middle column */
.column.middle {
  width: 50%;
}

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

/* Style the footer */
.footer {
  background-color: #f1f1f1;
  padding: 10px;
  text-align: center;
}

/* Responsive layout - makes the three columns stack on top of each other instead of next to each other */
@media (max-width: 600px) {
  .column.side, .column.middle {
    width: 100%;
  }
}
</style>
</head>
<body>

<h2>CSS Template using Float</h2>
<p>In this example, we have created a header, three unequal columns and a footer. On smaller screens, the columns will stack on top of each other.</p>
<p>Resize the browser window to see the responsive effect.</p>

<div class="header">
  <h2>Header</h2>
</div>

<div class="row">
  <div class="column side" style="background-color:#aaa;">Column</div>
  <div class="column middle" style="background-color:#bbb;">Column</div>
  <div class="column side" style="background-color:#ccc;">Column</div>
</div>

<div class="footer">
  <p>Footer</p>
</div>

</body>
</html>


Flexbox ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ CSS ﺐﻟﺎﻗ

.ﺪﯿﻨﯿﺒﺑ ﺍﺭ ﻮﮕﺨﺳﺎﭘ ﺮﺛﺍ ﺎﺗ ﺪﯿﻫﺩ ﺮﯿﯿﻐﺗ ﺍﺭ ﺮﮔﺭﻭﺮﻣ ﻩﺮﺠﻨﭘ ﻩﺯﺍﺪﻧﺍ .ﺪﻧﺮﯿﮔ ﯽﻣ ﺭﺍﺮﻗ ﻢﻫ ﯼ

ﻪﺟﻮﺗ: Flexbox ﺭﺩ Internet Explorer 10 ﻪﺨﺴﻧ ﻭﯽﻤﻧ ﯽﻧﺎﺒﯿﺘﺸﭘ

→ (flexbox ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ) ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ

<!DOCTYPE html>
<html lang="en">
<head>
<title>CSS Template</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
  box-sizing: border-box;
}

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

/* Style the header */
.header {
  background-color: #f1f1f1;
  padding: 30px;
  text-align: center;
  font-size: 35px;
}

/* Container for flexboxes */
.row {
  display: -webkit-flex;
  display: flex;
}

/* Create three unequal columns that sits next to each other */
.column {
  padding: 10px;
  height: 300px; /* Should be removed. Only for demonstration */
}

/* Left and right column */
.column.side {
   -webkit-flex: 1;
   -ms-flex: 1;
   flex: 1;
}

/* Middle column */
.column.middle {
  -webkit-flex: 2;
  -ms-flex: 2;
  flex: 2;
}

/* Style the footer */
.footer {
  background-color: #f1f1f1;
  padding: 10px;
  text-align: center;
}

/* Responsive layout - makes the three columns stack on top of each other instead of next to each other */
@media (max-width: 600px) {
  .row {
    -webkit-flex-direction: column;
    flex-direction: column;
  }
}
</style>
</head>
<body>

<h2>CSS Template using Flexbox</h2>
<p>In this example, we have created a header, three unequal columns and a footer. On smaller screens, the columns will stack on top of each other. Resize the browser window to see the responsive effect.</p>
<p><strong>Note:</strong> Flexbox is not supported in Internet Explorer 10 and earlier versions.</p>

<div class="header">
  <h2>Header</h2>
</div>

<div class="row">
  <div class="column side" style="background-color:#aaa;">Column</div>
  <div class="column middle" style="background-color:#bbb;">Column</div>
  <div class="column side" style="background-color:#ccc;">Column</div>
</div>

<div class="footer">
  <p>Footer</p>
</div>

</body>
</html>


Grid ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ CSS ﺐﻟﺎﻗ

.ﺪﻧﺮﯿﮔ ﯽﻣ ﺭﺍﺮﻗ ﻢﻫ ﯼﻭﺭ ﺎﻫ ﻥﻮﺘﺳ ،ﺮﺘﮑﭼﻮﮐ ﯼﺎﻫ ﻪﺤﻔﺻ ﺭﺩ .ﻢﯾﺍ ﻩﺩﺮﮐ ﺩﺎﺠﯾﺍ ﯽﻗﺭﻭﺎﭘ ﮏﯾ ﻭ

.ﺪﯿﻨﯿﺒﺑ ﺍﺭ ﻮﮕﺨﺳﺎﭘ ﺮﺛﺍ ﺎﺗ ﺪﯿﻫﺩ ﺮﯿﯿﻐﺗ ﺍﺭ ﺮﮔﺭﻭﺮﻣ ﻩﺮﺠﻨﭘ ﻩﺯﺍﺪﻧﺍ

ﻪﺟﻮﺗ: ﺡﺮﻃ ﻝﻭﮊﺎﻣﯼﺪﻨﺑ Grid ﺭﺩ Internet Explorer ﺎﯾ Edge 15

→ (ﻪﮑﺒﺷ ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ) ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ

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

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

/* Style the header */
.header {
  grid-area: header;
  background-color: #f1f1f1;
  padding: 30px;
  text-align: center;
  font-size: 35px;
}

/* The grid container */
.grid-container {
  display: grid;
  grid-template-areas: 
    'header header header header header header' 
    'left middle middle middle middle right' 
    'footer footer footer footer footer footer';
  /* grid-column-gap: 10px; - if you want gap between the columns */
} 

.left,
.middle,
.right {
  padding: 10px;
  height: 300px; /* Should be removed. Only for demonstration */
}

/* Style the left column */
.left {
  grid-area: left;
}

/* Style the middle column */
.middle {
  grid-area: middle;
}

/* Style the right column */
.right {
  grid-area: right;
}

/* Style the footer */
.footer {
  grid-area: footer;
  background-color: #f1f1f1;
  padding: 10px;
  text-align: center;
}

/* Responsive layout - makes the three columns stack on top of each other instead of next to each other */
@media (max-width: 600px) {
  .grid-container  {
    grid-template-areas: 
      'header header header header header header' 
      'left left left left left left' 
      'middle middle middle middle middle middle' 
      'right right right right right right' 
      'footer footer footer footer footer footer';
  }
}
</style>
</head>
<body>

<h2>CSS Template using Grid</h2>
<p>In this example, we have created a header, three unequal columns and a footer. On smaller screens, the columns will stack on top of each other.</p>
<p>Resize the browser window to see the responsive effect.</p>
<p><strong>Note:</strong> The Grid Layout Module is not supported in Internet Explorer or Edge 15 eand earlier versions.</p>

<div class="grid-container">
  <div class="header">
    <h2>Header</h2>
  </div>
  
  <div class="left" style="background-color:#aaa;">Column</div>
  <div class="middle" style="background-color:#bbb;">Column</div>  
  <div class="right" style="background-color:#ccc;">Column</div>
  
  <div class="footer">
    <p>Footer</p>
  </div>
</div>

</body>
</html>


Topnav، ﯽﻗﺭﻭﺎﭘ ﻭ ﺍﻮﺘﺤﻣ:

→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ

<!DOCTYPE html>
<html lang="en">
<head>
<title>CSS Template</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
}

/* Style the top navigation bar */
.topnav {
  overflow: hidden;
  background-color: #333;
}

/* Style the topnav links */
.topnav a {
  float: left;
  display: block;
  color: #f2f2f2;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
}

/* Change color on hover */
.topnav a:hover {
  background-color: #ddd;
  color: black;
}

/* Style the content */
.content {
  background-color: #ddd;
  padding: 10px;
  height: 200px; /* Should be removed. Only for demonstration */
}

/* Style the footer */
.footer {
  background-color: #f1f1f1;
  padding: 10px;
}
</style>
</head>
<body>

<div class="topnav">
  <a href="#">Link</a>
  <a href="#">Link</a>
  <a href="#">Link</a>
</div>

<div class="content">
  <h2>CSS Template</h2>
  <p>A topnav, content and a footer.</p>
</div>

<div class="footer">
  <p>Footer</p>
</div>

</body>
</html>


Sidenav ﺍﻮﺘﺤﻣ ﻭ:

→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ

<!DOCTYPE html>
<html lang="en">
<head>
<title>CSS Template</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
}

/* Style the side navigation */
.sidenav {
  height: 100%;
  width: 200px;
  position: fixed;
  z-index: 1;
  top: 0;
  left: 0;
  background-color: #111;
  overflow-x: hidden;
}


/* Side navigation links */
.sidenav a {
  color: white;
  padding: 16px;
  text-decoration: none;
  display: block;
}

/* Change color on hover */
.sidenav a:hover {
  background-color: #ddd;
  color: black;
}

/* Style the content */
.content {
  margin-left: 200px;
  padding-left: 20px;
}
</style>
</head>
<body>

<div class="sidenav">
  <a href="#">Link</a>
  <a href="#">Link</a>
  <a href="#">Link</a>
</div>

<div class="content">
  <h2>CSS Template</h2>
  <p>A full-height, fixed sidenav and content.</p>
</div>

</body>
</html>