Javascript-форум (https://javascript.ru/forum/)
-   (X)HTML/CSS (https://javascript.ru/forum/xhtml-html-css/)
-   -   использование :first-child (https://javascript.ru/forum/xhtml-html-css/26310-ispolzovanie-first-child.html)

bot87 04.03.2012 12:51

использование :first-child
 
Привет :) .
IE7 не поддерживает :before.Наткнулся на :first-child и захотелось сделать так
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Документ без названия</title>
<style>
*{padding:0;margin:0}
div#boo{position:relative;
width:300px;top:100px;
left:200px;
height:300px;
border:1px solid red;}
html,body{height:100%;position:relative}
/*div#boo:before{position:absolute;content:' ';
top:-40px;
left:-60px;
width:100px;
height:60px;
border:1px solid green}*/
div#boo:first-child{position:absolute;
top:-40px;
left:-60px;
width:100px;
height:60px;
border:1px solid olive}
</style>
</head>
<body>
<div id="boo"><p>relative xoxoxo</p></div>
</body>
</html>

Почему не работает?

KooL 04.03.2012 23:45

Хотел сделать одно, не придумал как, влепил от балды другое свойство, да ещё при этом сделав оксюморонный финт: div#boo:first-child. Id и так один на страницу обязан быть.
Знатный юмор в общем.

selo 06.03.2012 14:02

first-child это ж уже из CSS3. Вот старые браузеры и не поддерживают

KooL 06.03.2012 15:02

Ну как так можно?
http://htmlbook.ru/css/first-child


Часовой пояс GMT +3, время: 21:16.