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
Solved

Button css html image

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Index on a Table 6 25
Create an automated page index 9 51
Need HTML output in powershell line by line 3 28
simple html dom php accessing table/cell  values 4 22
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Find out what you should include to make the best professional email signature for your organization.
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

828 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