Solved

image inside css button

Posted on 2013-10-24
1
352 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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem to Popup 2 47
Best Practice CSS floating images 2 14
CSS help matching specific span class 2 20
HTML CSS 7 13
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
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 …
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…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now