SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: <strong> <em>

  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2011
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    <strong> <em>

    I'm trying to make some bold and italic text.
    When I use <strong> <em> it effects all the text even though I'm using <strong/>
    at the end of the text it still effect text further down the page?
    How do I then isolate?
    Thanks

  2. #2
    Mouse catcher silver trophy
    Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,822
    Mentioned
    110 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Barry360 View Post
    I'm trying to make some bold and italic text.
    When I use <strong> <em> it effects all the text even though I'm using <strong/>
    at the end of the text it still effect text further down the page?
    You'll kick yourself...

    The closing tag is </strong>, with the slash before the element name. That's the case for any non-empty element. It's only elements that can't contain any content that you put the slash at the end to make it self-closing (for example, <hr/> is equivalent to <hr></hr>).

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2011
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks

    Quote Originally Posted by Stevie D View Post
    You'll kick yourself...

    The closing tag is </strong>, with the slash before the element name. That's the case for any non-empty element. It's only elements that can't contain any content that you put the slash at the end to make it self-closing (for example, <hr/> is equivalent to <hr></hr>).
    Thanks Stevie D, so I close it like <strong/>

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,598
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Barry360 View Post
    Thanks Stevie D, so I close it like <strong/>
    No

    Code:
    <strong>   </strong>
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #5
    SitePoint Enthusiast
    Join Date
    Nov 2011
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    No

    Code:
    <strong>   </strong>
    Thanks!

  6. #6
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,731
    Mentioned
    31 Post(s)
    Tagged
    0 Thread(s)
    I'm trying to make some bold and italic text.

    Because of the humorous typo, we forgot to mention that since this is merely aesthetic you should use CSS and a semantically meaningful tag. So let say you wanted to put emphasis on a phrase of your paragraph.

    Code:
     .emphasis{ font-style:italic; font-weight:bold;}
     
    <p>Lorem ipsum  <em class="emphasis"> dolor sit amet</em>, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
    If you are highlighting that content for PURELY aesthetic reasons, use a SPAN instead of EM.



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •