Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

image inside css button

Posted on 2013-10-24
1
Medium Priority
?
370 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 1500 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

916 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