Solved

image inside css button

Posted on 2013-10-24
1
356 Views
Last Modified: 2013-10-28
This question is a follow up to this question:

http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/CSS/Q_28276648.html

I want to place this image
http://farm8.staticflickr.com/7446/10466150066_1c6b3cac4d_o.png

Inside of my buttons to the left of the word "button"
I want the picture to be above the gradient background color.

This is my code:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="CoolButton2.aspx.vb" Inherits="Gui1.CoolButton2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>CSS3 Buttons</title>
<%-------------- CSS Style --------------%>
<style type="text/css">


    
    body {
     width: 400px;
     margin: 200px auto;
     background: #666;
    }

    .button {
     width: 400px;
     height: 100px;
     line-height: 100px;
     color: white;
     text-decoration: none;
     font-size: 50px;
     font-family: helvetica, arial;
     font-weight: bold;
     display: block;
     text-align: center;
     position: relative;

     /* BACKGROUND GRADIENTS */
     background: #014464;
     background: -moz-linear-gradient(top, #0D658E, #0C577A 50%, #014D71 51%, #003E5C);
     background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #0E658E), color-stop(.5, #0C577A), color-stop(.5, #014D71), to(#003E5C)); 


     /* BORDER RADIUS */
     -moz-border-radius: 10px;
     -webkit-border-radius: 10px;
     border-radius: 10px;

     border: 1px solid #368DBE;
     border-top: 1px solid #c3d6df;


     /* TEXT SHADOW */

     text-shadow: 1px 1px 1px black;

     /* BOX SHADOW */
     -moz-box-shadow: 0 1px 3px black;
     -webkit-box-shadow: 0 1px 3px black;
     box-shadow: 0 1px 3px black;
    }
    
    /* WHILE HOVERED */
    .button:hover {
        background: #014464;
        background: -moz-linear-gradient(top, #0c5f85, #0b5273 50%, #024869 51%, #003853);
        background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #0c5f85), color-stop(.5, #0b5273), color-stop(.51, #024869), to(#003853));
    }
    
    /* WHILE BEING CLICKED */
    .button:active {
        -moz-box-shadow: 0 2px 6px black;
        -webkit-box-shadow: 0 2px 6px black;
    }
    /* FONT GLYPH (MOSTLY FOR FUN) */
    .button:before {
        font-family: Arial;
        background: url('http://farm8.staticflickr.com/7446/10466150066_1c6b3cac4d_o.png') no-repeat;
        color: #09232F;
        font-size: 90px;
        float: left;
        margin-left: 35px;
        margin-right: -10px;
        text-shadow: 0 1px 0 #4190AF;
    }
    

</style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
     <a href="#" class="button"> Button </a>
       <br /><br />
       <button class="button">Button</button>
        <br /><br />
        <asp:Button ID="Button1" runat="server" Text="Button" CssClass="button" />
        <br /><br />
        <input id="Button2" type="button" value="Button" class="button"/>
    </div>
    </form>
</body>
</html>

Open in new window


But it's not working.

What am I doing wrong?
0
Comment
Question by:maqskywalker
1 Comment
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39599166
Append you background CSS with a positioning. e.g.

background: url('http://farm8.staticflickr.com/7446/10466150066_1c6b3cac4d_o.png') no-repeat 5px 5px;

Just play around with the figures til it is where you want it, you can also use things like
left center
5px center
etc
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question