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

CSS Forum

    
Insert Image into CSS
BRoberson1657



 
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." />


***NOTE - FILE PATH IF NEEDED***
('App_Themes/Peacock/img/sidebar-ad1.png')

___________________________
ACTUAL FULL CODE FROM CSS:


<%@ 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>
<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>
<asp:Panel ID="pnlMainContent" runat="server" CssClass="homecontent">
<asp:ContentPlaceHolder ID="cpMainContent" runat="server" />
</asp:Panel>
</div>
<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." />
</asp:Panel>
<div style="clear: both"></div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cpTitleBar" runat="server">
<asp:ContentPlaceHolder ID="cpTitleBar" runat="server" />
</asp:Content>
____________________________

 

alt131

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?

rocknbil

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,


***NOTE - FILE PATH IF NEEDED***
('App_Themes/Peacock/img/sidebar-ad1.png')

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"; ....

BRoberson1657



 
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