0
<Meta charset=UTF-8> <meta name="viewport" content="width=device-width, initial-scale=1.0"> why this is same in all html .?
What does this statement do? please help me..
3 Answers
+ 4
The HTML charset Attribute
To display an HTML page correctly, a web browser must know the character set used in the page.
This is specified in the <meta> tag:
<meta charset="UTF-8">
From ASCII to UTF-8
ASCII was the first character encoding standard. ASCII defined 128 different characters that could be used on the internet: numbers (0-9), English letters (A-Z), and some special characters like ! $ + - ( ) @ < > .
ISO-8859-1 was the default character set for HTML 4. This character set supported 256 different character codes. HTML 4 also supported UTF-8.
ANSI (Windows-1252) was the original Windows character set. ANSI is identical to ISO-8859-1, except that ANSI has 32 extra characters.
The HTML5 specification encourages web developers to use the UTF-8 character set, which covers almost all of the characters and symbols in the world!
0
<!DOCTYPE html>
<html lang="tg">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Графики Системаи Муодилаҳо</title>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
canvas {
max-width: 600px;
margin: auto;
}
</style>
</head>
<body>
<h1>Графики системаи муодилаҳо</h1>
<canvas id="myChart"></canvas>
<script>
// Создани массиви барои х ва у
const xValues = [];
const y1Values = [];
const y2Values = [];
// Ҳисоб кардани функсияҳо барои диапазони х
for (let x = -10; x <= 10; x += 0.1) {
xValues.push(x);
y1Values.push((2 - 3*x) / 2); // Ҳисоб кардани функсия 3x + 2y = 2 => y = (2 - 3x) / 2
y2Values.push(2*x - 8); // Ҳисоб кардани функсия 2x - y = 8 => y = 2x - 8
}
// Создани график бо Chart.js
const ctx = document.getElementById('myChart').getContext('2d');
const myChart = new Chart(ctx, {
type: 'line',
data: {
labels: xValues,
datasets: [
{
label: '3x + 2y = 2',
data: y1Values,
borderColor: 'rgba(75, 192, 192, 1)',
backgroundColor: 'rgba(75, 192, 192, 0.2)',
fill: false,
},
{
label: '2x - y = 8',
data: y2Values,
borderColor: 'rgba(255, 99, 132, 1)',
backgroundColor: 'rgba(255, 99, 132, 0.2)',
fill: false,
},
{
label: 'Нуқтаи буриш K (-2, 4)',
data: [{x: -2, y: 4}],
backgroundColor: 'rgba(255, 20