2013-05-15 3 views
1

Я пытаюсь выделить и выделить некоторые слова (или сделать их выделенными курсивом, разными размерами и т. Д.) В абзаце в моем Index.HTML.HTML + CSS-стили/форматирование текста внутри контейнера Div

Но обычные теги форматирования (HTML) не работают.

У меня есть StyleSheet, который содержит все мои стили и свойства для веб-сайта, но я хочу только изменить три слова (например) в параграфе. Как мне это сделать?

index.html:

<div id="da-slider" class="da-slider"> 
    <div class="da-slide"> 
     <h2>This is the Heading</h2> 
     <p>And HERE is where I want to make this word BOLD and this WORD in a different color, for example</p> 
     <a href="#" class="da-link">Read more</a> 
    <div class="da-img"><img src="img/pp-slider/imac.png" alt="image01" /></div> 
</div> 

ответ

4

Установите этот флажок скрипку: here

Это немного пример.

Использую <strong>Word</strong>, чтобы сделать это полужирным шрифтом, но <b>Word</b> выполнит все правильно.

использовать <i></i> сделать слова курсивом. Также я использовал <span class="color">Word</span>, чтобы сделать его синим.

1

Wrap слова в <span>, а затем применить стиль к ним

HTML:

<p>And <span>HERE</span> is where I want to make this word <span>BOLD</span> and this <span>WORD</span> in a different color, for example</p> 

CSS:

#da-slider p span{ 
    color:#F00; 
    font-weight:bold; 
} 

Смотреть эту Fiddle

1

Использование:

Bold : <b> 
Italic : <i> 
Underline : <u> 

Пример:

Чтобы сделать текст <b>BOLD</b> и

сделать текст <b><i>BOLD and ITALIC</i></b>

Вы также можете использовать CSS с продолжительность:

Пример:

Это делает текст <span>Bold and italic</span>

Со следующим CSS:

span { 
    font-weight: bold; 
    font-style: italic; 
} 
1

Вы можете иметь желаемые результаты от заранее определенных HTML теги сильным, я, em, или вы можете установить отдельные классы для назначения различным элементам.

Вот документ, который вы можете сохранить & попробуйте ...

<!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> 
      body { 
       font-size:100%; 
       font-family:arial; 
      } 

      .boldme { 
       font-weight:bold; 
      } 

      .italicme { 
       font-style:italic; 
      } 

      .iambigger { 
       font-size:150%; 
      } 

      .colormered { 
       color:#FF0000; 
      } 
     </style> 
    </head> 
<body> 
    <div class="da-slide"> 
     <h2>This is the Heading</h2> 
     <p>And <span class="iambigger">HERE</span> is where I want to make <span class="italicme">this</span> word <span class="boldme">BOLD</span> and this <span class="colormered">WORD</span> in a different color, for example.</p> 
     <p>And by the way, <span class="boldme italicme iambigger colormered">I can have combinations of all</span></p> 
     <a href="#" class="da-link">Read more</a> 
     <div class="da-img"> 
      <img src="img/pp-slider/imac.png" alt="image01" /> 
     </div> 
    </div> 
</body> 
</html> 

Позвольте мне знать, если вам нужно знать что-нибудь еще ...

0

Вот Solution.

HTML-:

<div id="da-slider" class="da-slider"> 
    <div class="da-slide"> 
     <h2>This is the Heading</h2> 
     <p>And HERE is where I want to make this word <span>BOLD</span> and this <span>WORD</span> in a different color, for example</p> 
     <a href="#" class="da-link">Read more</a> 
    <div class="da-img"><img src="img/pp-slider/imac.png" alt="image01" /></div> 
</div> 
</div> 

CSS-:

.da-slide p span { 
    font-weight: bold; 
} 

Надеется, что это помогает.

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