2015-07-28 1 views
2

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

enter image description here

На этом изображении фон зеленый, но в некоторых случаях это изображение. Таким образом, наложение с цветом фона в тексте не будет работать.

Любые идеи?

+0

Поскольку вы делаете деньги от этого вы должны, вероятно, по крайней мере, попытаться показать пример вашей попытки закодировать это. Соедините скрипку или фрагмент. –

+0

Посмотрите это - http://stackoverflow.com/questions/31301716/overlap-border-of-parent-with-h2-margin-negative – Stickers

+0

Спасибо за ссылку. Я не мог найти это при поиске – Sjoerd

ответ

3

Вот пример, который я сделал для вас. Вам просто нужно применить положение: абсолютное; на контакт div, а затем настроить, где вы хотите, чтобы он перекрывал следующий div. http://jsfiddle.net/tzrhcmb4/

<div class="main"> 
    <div class="container"> 
     <div class="text-header">CONTACT</div> 
      <div class="text"> 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. 

    </div> 
    </div> 
</div> 

css: 

.main { background: green; width: 500px; height: 300px;} 
.container { width: 100%; height: 100%; padding-top: 20px;} 
.text-header { color: white; text-align: center; top: 30px; width: 110px; left: 35%; position: absolute; background: green;} 
.text { margin: 10px; text-align: left; padding: 20px 10px 20px 10px; border: 2px dashed lightgreen;} 

 Смежные вопросы

  • Нет связанных вопросов^_^