tags:

views:

327

answers:

4

Total noob question, but here.

CSS

.product__specfield_8_arrow {

    /*background-image:url(../../upload/orng_bg_arrow.png);
    background-repeat:no-repeat;*/
    background-color:#fc0;
    width:50px !important;
    height:33px !important;
    border: 1px solid #dddddd;
    border-left:none;
    border-radius:5px;
    -moz-border-radius:5px;
    -webkit-border-radius:5px;
    border-bottom-left-radius:0px;
    border-top-left-radius:0px;
    -moz-border-radius-bottomleft:0px;
    -moz-border-radius-topleft:0px;
    -webkit-border-bottom-left-radius:0px;
    -webkit-border-top-left-radius:0px;
    margin:0;
    padding:2px;
    cursor:pointer;
}​​​

HTML

<span class="product__specfield_8_arrow">&nbsp;</span>​

Fiddle

Basically I'm trying to emulate a button, make a span (or something) look like a button next to an input field that actually doesn't need to be one because of an auto fill generator that generates errors onEnter. Thought this'd be a quick fix for now but obviously not.

Thanks.

+11  A: 

Span is an inline element. It has no width or height.

You could turn it into a block-level element, then it will accept your dimension directives.

span.product__specfield_8_arrow
{
    display: block; /* or inline-block */
}
Developer Art
w0w this is such a good answer
c0mrade
Thanks, fixed it. I tried display:block before but inline block fixed it.
Kyle Sevenoaks
+1  A: 

spans are by default displayed inline, which means they don't have a height and width.

Try adding a display: block to your span.

Edan Maor
+1  A: 

Span starts out as an inline element. You can change its display attribute to block, for instance, and its height/width attributes will start to take effect.

A: 
Isaac
a div is not a semantic replacement for a span. A span is a textual container whereas a div is a layout container. Applying an inline-block style like Developer Art has suggested is the correct answer.
Brian Scott
The question provides no context to indicate that a div is inherently inappropriate semantically.
Isaac
Actually, reading the op's markup it actually looks like the element in question is being used to simply display a background image. In this case a div would actually be more appropriate. -1 removed from Isaac's original comment.
Brian Scott
Further, I tried to use a div before switching to span, it always displays under the previous div.. So went with Span :)
Kyle Sevenoaks