SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast wwright's Avatar
    Join Date
    Nov 2002
    Location
    Florida
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Inserting a DIV class into a paragraph

    Hi all,

    My problem is whenever I insert div="classname" into a paragraph, where the div is wrapped around only one word within that paragraph, immeiately after I close the div, it pushes the rest of the sentance down to the next line as if I inserted a <br> but did not.

    Any thoughts...

    Thanks wwright

  2. #2
    Old Fogey mancroft's Avatar
    Join Date
    Oct 2002
    Location
    lost
    Posts
    445
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <p> does a line feed at the end of every paragraph. <div> duzznt. that is the only difference between the two as i know.

    why not try:

    <div class="style1">

    blah1

    <span class="style2">blah2</span>

    blah3

    </div>
    :

    :

  3. #3
    SitePoint Guru bronze trophy blufive's Avatar
    Join Date
    Mar 2002
    Location
    Manchester, UK
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A <div> is a block level element. Inserting it into the middle of a block of text will cause a break in the text. Use a <span> instead, which is inline.

  4. #4
    SitePoint Enthusiast wwright's Avatar
    Join Date
    Nov 2002
    Location
    Florida
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Sorry...



    This is my fault but I forgot to add that the word is actually a link. And that link's properties (i.e hover color, etc.) is controlled by an external style sheet.

    So I can get the font color of that word to change color with the span tag, but that does nothing for the link. So how would I get the link to act the way I specified it to act in the css, and not put in a line break in the middle of the sentence that the word is in

  5. #5
    SitePoint Guru bronze trophy blufive's Avatar
    Join Date
    Mar 2002
    Location
    Manchester, UK
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can we see the source code? (or the page)

  6. #6
    SitePoint Enthusiast wwright's Avatar
    Join Date
    Nov 2002
    Location
    Florida
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well I was making it harder than it needed to be. All I wanted was to be able to have a link within a paragraph that when hovered over would change the background color of that link, with out causing a line break after the link. I didn't know how to do it other than using a <div> tag, which does cause a line break. So it was this that worked...finally

    A:link { color: #6783ad; text-decoration: none; }
    A:visited { color: #6783ad; text-decoration: none;}
    A:hover { color: #000000; background-color:#6783ad; text-decoration: none; }
    A:active { color: navy; text-decoration: none;}


    I'm sure that everyone already knew that except me, but this is how we learn

    Thanks to all or your help.

    wwright


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
  •