homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Gold Sponsor 2015!
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

Insert Image into CSS

Msg#: 4397455 posted 3:58 pm on Dec 13, 2011 (gmt 0)

I am trying to add a line of code so that an image appears in my website's sidebar. I am editing the "SIDEBAR" section. I've included a copy of the code I'm using, the actual file path of the image source, and a copy of the css page's complete code from top to bottom.
Can anyone read this and tell me where my mistake is coming from? So far I am only getting it to acknowledge the ALT text but it omits the image....

My code looks like this:

<img src="sidebar-ad1.png"; alt="New art is added daily! Don't forget to browse our templates for the newest in trends, styles and seasonal designs." />



<%@ Master Language="VB" MasterPageFile="~/PrintnowDisplay.Master" AutoEventWireup="false" CodeBehind="PrintnowHomeDisplay.master.vb" Inherits="Printnow.PrintnowHomeDisplay" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cpHead" runat="server">
<asp:ContentPlaceHolder ID="cpHead" runat="server" />
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainBody" runat="server">
<div class="maincontenthome">
<asp:Panel ID="pnlBanner" runat="server">
<asp:ContentPlaceHolder ID="cpBannerContent" runat="server" />
<asp:Panel ID="pnlMainContent" runat="server" CssClass="homecontent">
<asp:ContentPlaceHolder ID="cpMainContent" runat="server" />
<asp:Panel ID="pnlSidebar" runat="server" CssClass="sidebar">
<asp:ContentPlaceHolder ID="cpSideBar" runat="server" />
<img src="sidebar-ad1.png"; alt="New art is added daily! Don't forget to browse our templates for the newest in trends, styles and seasonal designs." />
<div style="clear: both"></div>
<asp:Content ID="Content3" ContentPlaceHolderID="cpTitleBar" runat="server">
<asp:ContentPlaceHolder ID="cpTitleBar" runat="server" />



WebmasterWorld Senior Member 5+ Year Member

Msg#: 4397455 posted 6:29 pm on Dec 15, 2011 (gmt 0)

Hi BRoberson1657, couple of suggestions:
Just note this isn't the css file, it's asp - you are coding in the img element, not using css to style it. I don't expect this will be causing the problem, but check the <img> and remove that stray semi-colon:
<img src="sidebar-ad1.png" ; <----
Finally, have you checked the image is in the right directory/folder or that you have provided the correct path in the image src?


WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 4397455 posted 5:12 pm on Dec 16, 2011 (gmt 0)

Look at this,

<img src="sidebar-ad1.png"; ....

now this,


and answer: What page is calling this?

default.asp <- won't work

themes/default.asp <- won't work

App_Themes/Peacock/img/default.asp <-- WILL work

Give this a shot, which should work wherever you are:

<img src="/App_Themes/Peacock/img/sidebar-ad1.png"; ....


Msg#: 4397455 posted 6:46 pm on Dec 16, 2011 (gmt 0)

That did it. Web Masters save the day again. Thanks so much!

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved