• Resolved showgirl

    (@showgirl)


    Hello

    I am trying to put a button in my sidebar text widget but it will not show up. I generated the html for the button on another site and thought it would be a simple matter of pasting it into a widget. I have done this and it doesn’t show up at all. I have saved the uploaded the image to my ftp server’s images folder and doen’t know why it’s not showing up.

    Can someone tell me what I’m doing wrong, my site is https://www.urbanspirit.co.uk and it’s text widget 1 and I’ve attached the code below:

    <a href="https://www.urbanspirit.co.uk/index.php/reiki/"
    <div id='button8706' style='>
    height: 100; width: 145;
    background: url(button58189594.jpg); background-position: 0px 0px; '
    onmouseover = 'document.getElementById("button8706").style.backgroundPosition = "-145px 0px"; '
    onmouseout =  'document.getElementById("button8706").style.backgroundPosition = "0px 0px"; '
    ></div>
    </a>

    Thanks

Viewing 10 replies - 1 through 10 (of 10 total)
  • I checked ur website but I didn’t find any widgets in it!
    By the way are u using any plugins to cache wordpress?
    If so the changes u make into your website takes sometime to show up.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    <a href="https://www.urbanspirit.co.uk/index.php/reiki/"
    <div id='button8706' style='>
    height: 100; width: 145;
    background: url(button58189594.jpg); background-position: 0px 0px; '
    onmouseover = 'document.getElementById("button8706").style.backgroundPosition = "-145px 0px"; '
    onmouseout =  'document.getElementById("button8706").style.backgroundPosition = "0px 0px"; '
    ></div>
    </a>

    That code is seriously screwed up. It’s not valid HTML. I’m not sure what you’re trying to do, but whatever it is, you’re doing it wrong.

    Your initial anchor tag is not closed, the DIV has an unclosed style in it, and overall it’s just a very weird way of trying to do a mouseover image.

    My advice: Stop using weird tricks like this. Stick to IMG tags for images. Use preloading instead of shifting backgrounds for mouseover images. And write proper HTML.

    Thread Starter showgirl

    (@showgirl)

    No, I’m not using a plug-in to cache wordpress and the widgets are definitely there as they make up my sidebar.

    I didn’t write the code and I have also tried uing img tags which is also not working! I used a generator, all I want is an eye-catching button to add to my sidebar to link to a particular page, the html is for a plain blue button with a link.

    Maybe it is a widget issue, is there some plug-in that could help with this as I am using the widget that was supplied with the theme.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    It is not a widget issue, the issue is that your HTML code is invalid and would never work because it’s not valid.

    I don’t know what generator you used, but it sucks. That code can never possibly work.

    This might do what you’re wanting, but since I have no idea what you’re wanting, I cannot say for sure:

    <a href="https://www.urbanspirit.co.uk/index.php/reiki/">
    <div id='button8706'
    style='height: 100; width: 145; background: url(button58189594.jpg); background-position: 0px 0px;'
    onmouseover='document.getElementById("button8706").style.backgroundPosition="-145px 0px";'
    onmouseout='document.getElementById("button8706").style.backgroundPosition="0px 0px";'></div>
    </a>

    Also, there’s no button58189594.jpg on your server that I can find, so you’ll have to either upload it or change the path of it in the code above for that to work correctly.

    Thread Starter showgirl

    (@showgirl)

    Thank you for fixing my code, I am trying to add an html image to my sidebar that links to one of my pages. I have uploaded the image to my images folder of my server, he same one that houses my logo and that shows up so I don’t know why it cannot be seen, I can see it.

    Thanks for the tp on changing the path, how do I do that? When I go to my image on the server it has an address shall I use that and if so where? If yes,shall I replace ftp. with https://www.?

    Really appreciate this help, thanks.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    Try this then:

    <a href="https://www.urbanspirit.co.uk/index.php/reiki/">
    <div id='button8706'
    style='height: 100; width: 145; background: url(https://www.urbanspirit.co.uk/wp-content/themes/jewelrybox-01/images/button58189594.jpg); background-position: 0px 0px;'
    onmouseover='document.getElementById("button8706").style.backgroundPosition="-145px 0px";'
    onmouseout='document.getElementById("button8706").style.backgroundPosition="0px 0px";'></div>
    </a>
    Thread Starter showgirl

    (@showgirl)

    Unfortunatlely still no joy! Thanks Otto, I really thought it was going to work!

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    This code works. I just tested it.

    <a href="https://www.urbanspirit.co.uk/index.php/reiki/">
    <div id='button8706'
    style='height: 100px; width: 145px; background: url(https://www.urbanspirit.co.uk/wp-content/themes/jewelrybox-01/images/button58189594.jpg); background-position: 0px 0px;'
    onmouseover='document.getElementById("button8706").style.backgroundPosition="-145px 0px";'
    onmouseout='document.getElementById("button8706").style.backgroundPosition="0px 0px";'></div>
    </a>
    Thread Starter showgirl

    (@showgirl)

    Thanks Otto42, it now works. Much appreciated ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Problem with html in text widget’ is closed to new replies.