Стили CSS не применяются к html-странице в ChromeCSS

Разбираемся в CSS
Ответить Пред. темаСлед. тема
Anonymous
 Стили CSS не применяются к html-странице в Chrome

Сообщение Anonymous »

Я применил стили с помощью внутреннего кода CSS, однако стили не применяются к веб-странице HTML в браузере. Я везде устранил неполадки, но до сих пор не могу это исправить. Как ни странно, стиль также не отображается в элементе проверки. Я только начинаю программировать, поэтому понятия не имею, в чем проблема. Вот мой код:

Код: Выделить всё

let balance = 10000;
let stocks = [];

// Function to fetch stock price using Alpha Vantage API
async function getStockPrice(symbol) {
try {
const apiKey = 'YOUR_API_KEY'; // Replace 'YOUR_API_KEY' with your actual Alpha Vantage API key
const response = await fetch(`https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=${symbol}&apikey=${apiKey}`);
const data = await response.json();

// Extract the latest stock price from the API response
const latestPrice = parseFloat(data['Global Quote']['05.  price']);

return latestPrice;
} catch (error) {
console.error('Error fetching stock price:', error);
return null;
}
}

function buyStock(event) {
event.preventDefault(); // Prevent form submission
const stockSymbol = document.getElementById("stockInput").value.toUpperCase();
const quantity = parseInt(document.getElementById("quantityInput").value);

getStockPrice(stockSymbol).then(stockPrice => {
const totalCost = stockPrice * quantity;

// Check if the user has enough balance to buy stocks
if (totalCost  {
const option = document.createElement("option");
option.value = stock.symbol;
option.textContent = `${stock.quantity} shares of ${stock.symbol}`;
sellDropdown.appendChild(option);
});
}

function findStockIndex(symbol) {
for (let i = 0; i < stocks.length; i++) {
if (stocks[i].symbol === symbol) {
return i;
}
}
return -1;  // Stock symbol not found
}

document.getElementById("buyForm").addEventListener("submit", buyStock);
document.getElementById("sellForm").addEventListener("submit", sellStock);

Код: Выделить всё

body {
font-family: 'Roboto Mono', monospace;
color: #fff;
background-color: #000;
margin: 0;
padding: 0;
}

header {
background-color: #333;
color: #fff;
padding: 20px;
text-align: center;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

h1 {
margin: 0;
font-size: 36px;
}

section {
padding: 20px;
background-color: #222;
margin: 20px auto;
max-width: 600px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

h2 {
margin-top: 0;
font-size: 24px;
color: #fff;
}

form {
max-width: 400px;
margin: 0 auto;
}

label {
margin-bottom: 10px;
font-size: 16px;
}

input[type="text"],
input[type="number"],
button {
margin-bottom: 20px;
padding: 12px;
font-size: 16px;
border: 1px solid #ccc;
border-radius: 4px;
background-color: #333;
color: #fff;
transition: border-color 0.3s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
button:focus {
outline: none;
border-color: #007bff;
}

button {
cursor: pointer;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 4px;
padding: 12px 20px;
font-size: 18px;
transition: background-color 0.3s ease;
}

button:hover {
background-color: #0056b3;
}

#stockList {
list-style: none;
padding: 0;
}

footer {
background-color: #333;
color: #fff;
text-align: center;
padding: 20px;
position: fixed;
bottom: 0;
width: 100%;
}

Код: Выделить всё

Stock Market Simulator
Your Balance: $10000



Buy Stocks

Stock Symbol:

Quantity:

Buy




Your Stocks
[list]

[/list]



Sell Stocks






© 2024 Stock Market Simulator


Я пробовал действия по устранению неполадок в соответствии со стеком и чатгптом, но ничего не помогает< /п>

Подробнее здесь: https://stackoverflow.com/questions/784 ... -in-chrome
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • Angular — стили CSS не применяются к динамическим узлам HTML.
    Anonymous » » в форуме CSS
    0 Ответы
    28 Просмотры
    Последнее сообщение Anonymous
  • Что приводит к тому, что стили CSS не применяются, что приводит к другому рендерингу [закрыто]
    Гость » » в форуме CSS
    0 Ответы
    100 Просмотры
    Последнее сообщение Гость
  • Стили CSS не применяются в языке GTK4 C.
    Anonymous » » в форуме CSS
    0 Ответы
    56 Просмотры
    Последнее сообщение Anonymous
  • Стили CSS не применяются в языке GTK4 C.
    Anonymous » » в форуме CSS
    0 Ответы
    54 Просмотры
    Последнее сообщение Anonymous
  • Стили CSS не применяются к кнопке: как убрать синюю подсветку при нажатии?
    Anonymous » » в форуме CSS
    0 Ответы
    29 Просмотры
    Последнее сообщение Anonymous

Вернуться в «CSS»