Solved

Button css html image

Posted on 2014-01-15
5
657 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 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JavaScript Loan Calculator Error 3 34
White space in figure / img 4 20
Text color and background in a text box. 2 25
Display Flex does not Wrap Items 2 9
This article discusses four methods for overlaying images in a container on a web page
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…
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 …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

749 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