X   Сообщение сайта
(Сообщение закроется через 3 секунды)



 

Здравствуйте, гость (

| Вход | Регистрация )

Открыть тему
Тема закрыта
> Головоломка с отображением исходного кода
vadimon
vadimon
Topic Starter сообщение 9.12.2010, 20:05; Ответить: vadimon
Сообщение #1


Имеются три блока. Например:

HTML
<div id="container">
    <div id="block1">
        <h2>Блок №1</h2>
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
    </div>
    
    <div id="block2">
        <h1>Блок №2</h1>
        <p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</p>
    </div>
    
    <div id="block3">
        <h3>Блок №3</h3>
        <p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32. The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.</p>
    </div>
</div>


CSS
#container { width:900px; margin:0 auto;}
#block1, #block2, #block3 { width:300px; float:left; background:#CCCCCC;}
#block1 p, #block2 p, #block3 p {padding:10px;}


При просмотре исходного кода в браузере видно, что код расположен, как мы и прописывали его, т.е сначала идет код Блока№1, потом Блока №2 и Блока №3.

Так вот, суть задачи в том, чтобы при том же самом расположении блоков на странице браузера Блок №1 - Блок №2 - Блок №3, в исходном коде в браузере код шел в таком порядке: Блок №2 - Блок №1 - Блок №3


--------------------
0
Вернуться в начало страницы
 
Ответить с цитированием данного сообщения
FightInGlory
FightInGlory
сообщение 10.12.2010, 19:09; Ответить: FightInGlory
Сообщение #2


<!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>Untitled Document</title>
<style type="text/css">
*{
padding:0;
margin:0;
}
#container { width:900px; margin:0 auto; position:relative}
#block1, #block2, #block3 { width:300px; background:#CCCCCC; display:inline; position:absolute; top:0;}
#block1 p, #block2 p, #block3 p {padding:10px;}
#block3{
right:0;
}
#block2{
left:0;
}
#block1{
left:300px;
}
</style>
</head>
<body>
<div id="container">
<div id="block1">
<h2>Блок №1</h2>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>

<div id="block2">
<h1>Блок №2</h1>
<p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</p>
</div>

<div id="block3">
<h3>Блок №3</h3>
<p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32. The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.</p>
</div>
</div>
</body>
</html>
Вернуться в начало страницы
 
Ответить с цитированием данного сообщения
Zippovich
Zippovich
сообщение 10.12.2010, 20:57; Ответить: Zippovich
Сообщение #3


так теряется height container-а (абсолют выдергивает блоки из стандартного потока и height надо выставлять под container фиксированный)

вот так так сделайте, что бы не терять height:

[CSS]#block1 {display: inline-block}
#block2 {float: left}
#block3 {float: right}[/CSS]
Вернуться в начало страницы
 
Ответить с цитированием данного сообщения
FightInGlory
FightInGlory
сообщение 11.12.2010, 11:57; Ответить: FightInGlory
Сообщение #4


данный способ работает не во всех браузерах, для ослов придется прописывать отдельные стили.

Замечание модератора:
Эта тема была закрыта автоматически ввиду отсутствия активности в ней на протяжении 100+ дней.
Если Вы считаете ее актуальной и хотите оставить сообщение, то воспользуйтесь кнопкой
или обратитесь к любому из модераторов.
Вернуться в начало страницы
 
Ответить с цитированием данного сообщения
Открыть тему
Тема закрыта
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0


Свернуть

> Похожие темы

  Тема Ответов Автор Просмотров Последний ответ
Открытая тема (нет новых ответов) Тема имеет прикрепленные файлыДайте, пожалуйста, фрагмент кода на джаваскрипте для калькулятора на сайте
3 re-search 1379 7.7.2019, 15:20
автор: web-coder
Открытая тема (нет новых ответов) Чистка вредного кода на сайтах WP
0 SkyFire 2301 24.12.2017, 11:30
автор: SkyFire
Открытая тема (нет новых ответов) Нужна помощь в изменении кода сайта.
6 sanuzelservice 5921 2.12.2015, 15:07
автор: -sanuzelservice-
Открытая тема (нет новых ответов) Проблема с отображением верстки в Safari
0 Razorio 2984 9.11.2015, 19:38
автор: -Razorio-
Горячая тема (нет новых ответов) Услуги по валидации кода
37 alizid1 14070 31.1.2015, 15:02
автор: kstnews


 



RSS Текстовая версия Сейчас: 25.4.2024, 6:16
Дизайн