Solved

Button css html image

Posted on 2014-01-15
5
633 Views
Last Modified: 2014-01-15
Hey have an image button that I want to make into html / css, can I have the blue part of the css and the cart part as a small picture?

The image and button example:
the image and button example
Code tothe button:
 font-family: Bebas Neue,Arial, verdana;
      font-size: 17pt;
      color:#000000;
	-moz-box-shadow:inset 0px 0px 0px 0px #ffffff;
	-webkit-box-shadow:inset 0px 0px 0px 0px #ffffff;
	box-shadow:inset 0px 0px 0px 0px #ffffff;
	background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #f9f9f9), color-stop(1, #e9e9e9));
	background:-moz-linear-gradient(top, #f9f9f9 5%, #e9e9e9 100%);
	background:-webkit-linear-gradient(top, #f9f9f9 5%, #e9e9e9 100%);
	background:-o-linear-gradient(top, #f9f9f9 5%, #e9e9e9 100%);
	background:-ms-linear-gradient(top, #f9f9f9 5%, #e9e9e9 100%);
	background:linear-gradient(to bottom, #f9f9f9 5%, #e9e9e9 100%);
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#e9e9e9',GradientType=0);
	background-color:#f9f9f9;
	-moz-border-radius:5px;
	-webkit-border-radius:5px;
	border-radius:5px;
	border:1px solid #dcdcdc;
	display:inline-block;
	cursor:pointer;
	


	padding:10px 5px 10px 5px;
    width: 100%;
	text-decoration:none;
	text-shadow:-1px 0px 0px #ffffff;

Open in new window

0
Comment
Question by:MickeC
5 Comments
 
LVL 25

Expert Comment

by:Kyle Hamilton
Comment Utility
you can have an image and a gradient at the same time:
background:url(path/to/image.png), -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #f9f9f9), color-stop(1, #e9e9e9));
background:url(path/to/image.png), -moz-linear-gradient(top, #f9f9f9 5%, #e9e9e9 100%);
background:url(path/to/image.png), -webkit-linear-gradient(top, #f9f9f9 5%, #e9e9e9 100%);
background:url(path/to/image.png), -o-linear-gradient(top, #f9f9f9 5%, #e9e9e9 100%);
background:url(path/to/image.png), -ms-linear-gradient(top, #f9f9f9 5%, #e9e9e9 100%);
background:url(path/to/image.png), linear-gradient(to bottom, #f9f9f9 5%, #e9e9e9 100%);
	

Open in new window

0
 
LVL 58

Expert Comment

by:Gary
Comment Utility
Taking your css above just add
padding-left:40px; /* force the text over - just tweak to the width of your cart image and add a bit */
background-image:ur;(pathtoimage/image.jpg) left center;

Open in new window

Where the image is your blue cart bit.
0
 

Author Comment

by:MickeC
Comment Utility
Thankz Kyle, in the different resolutions (responsive) do i have to meak the button smaller, or is the onother aprotch?

http://www.smavitt.se/utv/
0
 
LVL 25

Expert Comment

by:Kyle Hamilton
Comment Utility
hmm. the problem is, it's a very wide button. as it is, the text doesn't fit.

I would start by making the .price-card width 100%, (or just remove the width), and make the font-size a bit smaller, so that at least in a full desktop view, the whole button can be seen.

there is no "easy" way to make the text shrink as you re-size the window, though. The boxes containing the products get pretty narrow - maybe they should have a min-width, the number of columns could reduce as the page narrows. I think this is a larger issue than just the button
0
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
Comment Utility
You are using bootstrap.  You have some choices.  Either create multiple buttons and use visible and hidden based on size (.visible-xs) see http://getbootstrap.com/css/#responsive-utilities-tests

Or you can use your own media queries and specify the options for your button in each of

@media (max-width: 768px { ... }
@media (min-width: 769px) and (max-width: 792px) { ... }
@media (min-width: 793px) and (max-width: 1200px) { ... }
@media (min-width: 1200px) { ... }

Open in new window

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

762 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

6 Experts available now in Live!

Get 1:1 Help Now