Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > Web программирование > HTML и CSS
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 26.11.2016, 17:22   #1
сергей Стефаненко
Новичок
Джуниор
 
Регистрация: 26.11.2016
Сообщений: 1
По умолчанию Не подключается css

Когда пишу в css не работают стили, фоны и т.д.(сам файл css я подкл.).
1.html
Код HTML:
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"> 
    <link rel="stylesheet" href="style.css">
</head>
<body>
<div id="ggg">
<a href="#">Главная</a>
<span>/</span>
<a href="#">Загадки</a>
<span>/</span>
<a href="#">Угадайка</a>
<span>/</span>
<a href="#">Угадайка мультиплеер</a>
<span></span>
</div>
<div id="main">
<p>Личный сайт студента GeekBrains
</p>
<img src="img/photo.png" alt="фотография">
	<p>Добрый день. Меня зовут <b>Серегй Стефаненко</b>.
	<br>
	 Я - <i>начинающий программист</i>. Я совсем недавно стал на этот путь,но уже успел написать свой первый сайт.
	</p>
		<p>
		В этом не помог курс основы програмированния
		</p>
		<p>
		На этом сайте вы сможете сыграть в три игры,которыя я написал:
		</p>
<a href="#">Главная</a> <a href="#">загадки</a> <a href="#">Угадайка</a> <a href="#">Угадайка мультиплеер</a>
</div>		
Copyright © 2016 <a href="https://geekbrains.ru/" target="_blank">GeekBrains</a>
</body>
</html>
2.А вот css
Код:
#main {
color: #242424;
}

Последний раз редактировалось Вадим Мошев; 26.11.2016 в 18:42.
сергей Стефаненко вне форума Ответить с цитированием
Старый 26.11.2016, 18:53   #2
Вадим Мошев

Старожил
 
Аватар для Вадим Мошев
 
Регистрация: 12.11.2010
Сообщений: 8,568
По умолчанию

Что здесь не работает по вашему мнению?
Быть может, оттого, что цвет текста кажется чёрным, вы полагаете, что эффекта нет?
Установите в css другой цвет и посмотрите на результат.

Кстати, советы.
1. Пользуйтесь HTML-мнемониками вместо символов "слеш" (/)
2. Для подключения стилей через link указывайте MIME-тип:
Код:
<link rel="stylesheet" type="text/css" href="style.css">

Последний раз редактировалось Вадим Мошев; 26.11.2016 в 21:44.
Вадим Мошев вне форума Ответить с цитированием
Старый 26.11.2016, 19:03   #3
Alex11223
Старожил
 
Аватар для Alex11223
 
Регистрация: 12.01.2011
Сообщений: 19,500
По умолчанию

Цитата:
Сообщение от Вадим Мошев Посмотреть сообщение
2. Для подключения стилей через link указывайте MIME-тип
зачем?
Ушел с форума, https://www.programmersforum.rocks, alex.pantec@gmail.com, https://github.com/AlexP11223
ЛС отключены Аларом.
Alex11223 вне форума Ответить с цитированием
Старый 26.11.2016, 19:40   #4
Вадим Мошев

Старожил
 
Аватар для Вадим Мошев
 
Регистрация: 12.11.2010
Сообщений: 8,568
По умолчанию

Цитата:
Сообщение от Alex11223 Посмотреть сообщение
зачем?
Ну, таким образом размещается информация о типе содержимого внешнего документа
Вадим Мошев вне форума Ответить с цитированием
Старый 26.11.2016, 19:46   #5
Alex11223
Старожил
 
Аватар для Alex11223
 
Регистрация: 12.01.2011
Сообщений: 19,500
По умолчанию

И кому она нужна?
Ушел с форума, https://www.programmersforum.rocks, alex.pantec@gmail.com, https://github.com/AlexP11223
ЛС отключены Аларом.
Alex11223 вне форума Ответить с цитированием
Старый 26.11.2016, 19:56   #6
Вадим Мошев

Старожил
 
Аватар для Вадим Мошев
 
Регистрация: 12.11.2010
Сообщений: 8,568
По умолчанию

Ну вот о необходимости я не мог найти информацию...
Вадим Мошев вне форума Ответить с цитированием
Старый 26.11.2016, 20:08   #7
Alex11223
Старожил
 
Аватар для Alex11223
 
Регистрация: 12.01.2011
Сообщений: 19,500
По умолчанию

rel необходим, type можно не писать.
По стандарту
Цитата:
It is purely advisory......
For external resource links, the type attribute is used as a hint to user agents so that they can avoid fetching resources they do not support. If the attribute is present, then the user agent must assume that the resource is of the given type (even if that is not a valid MIME type, e.g. the empty string). If the attribute is omitted, but the external resource link type has a default type defined, then the user agent must assume that the resource is of that type. If the UA does not support the given MIME type for the given link relationship, then the UA should not obtain the resource; if the UA does support the given MIME type for the given link relationship, then the UA should obtain the resource at the appropriate time as specified for the external resource link's particular type. If the attribute is omitted, and the external resource link type does not have a default type defined, but the user agent would obtain the resource if the type was known and supported, then the user agent should obtain the resource under the assumption that it will be supported.

User agents must not consider the type attribute authoritative — upon fetching the resource, user agents must not use the type attribute to determine its actual type. Only the actual type (as defined in the next paragraph) is used to determine whether to apply the resource, not the aforementioned assumed type.

If the external resource link type defines rules for processing the resource's Content-Type metadata, then those rules apply. Otherwise, if the resource is expected to be an image, user agents may apply the image sniffing rules, with the official type being the type determined from the resource's Content-Type metadata, and use the resulting sniffed type of the resource as if it was the actual type. Otherwise, if neither of these conditions apply or if the user agent opts not to apply the image sniffing rules, then the user agent must use the resource's Content-Type metadata to determine the type of the resource. If there is no type metadata, but the external resource link type has a default type defined, then the user agent must assume that the resource is of that type.
Цитата:
The default type for resources given by the stylesheet keyword is text/css.
Ушел с форума, https://www.programmersforum.rocks, alex.pantec@gmail.com, https://github.com/AlexP11223
ЛС отключены Аларом.
Alex11223 вне форума Ответить с цитированием
Старый 27.11.2016, 04:39   #8
Naive
Раздолбайских Дел
Старожил
 
Аватар для Naive
 
Регистрация: 22.05.2009
Сообщений: 3,828
По умолчанию

type нужен был для ишаков младше 7 (IE6-)
В общем, сейчас уже не актуально)
Alar, верни репу!
Naive вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск


Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
На CMS WIX удаленно подключается файл .css, но не работает @font-face Bender1000 WordPress и другие CMS 0 18.03.2015 08:08
CSS не подключается к HTML far1towi4 HTML и CSS 4 23.04.2013 02:57
Не подключается к серверу Ardarik БД в Delphi 25 03.02.2013 20:09
не подключается бд на хосте hunter03 PHP 11 18.07.2012 20:50
не подключается БД yulia БД в Delphi 8 13.12.2007 16:34