?
Solved

Button css html image

Posted on 2014-01-15
5
Medium Priority
?
660 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 25

Expert Comment

by:Kyle Hamilton
ID: 39783343
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
ID: 39783377
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
ID: 39783631
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
ID: 39783670
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 53

Accepted Solution

by:
Scott Fell,  EE MVE earned 2000 total points
ID: 39783819
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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
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…
Suggested Courses

771 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