Can't Apply Width and Height to -Webkit-Scrollbar Using CSS

Does height and width not apply to span?

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: inline-block; /* or block */
}

cant set width and height on div

<div> elements normally have display:block; applied but you must have somehow changed this to display:inline;

If you didn't do this yourself, it might have been a boilerplate CSS that you used that caused this.

To be able to adjust the width, change the display to:

display:block;

or this will also work and may be preferable if you previously found a need to remove the default block display:

display:inline-block;

Another possibility could be that your div is contained within another div and that parents divs overflow is set to hidden.

width and height doesn't seem to work on :before pseudo-element

Note: The ::before and ::after pseudo-elements are actually laid display: inline; by default.

Change the display value to inline-block for the width & height to take effect while maintaining inline formatting context.

a.infolink::before {
content: '?';
display: inline-block;
background: blue;
color: white;
width: 20px;
height: 20px;
}

http://jsfiddle.net/C7rSa/3/

CSS width and height not working for div with display: inline

display:inline elements are rendered inline - meaning they do not respect width and height declarations but just 'go with the flow'.

You probably intend to use display:inline-block instead, making it behave like a block element itself, but follow the parent's flow as an inline element.

The fixed fiddle.

HTML+CSS: 'a' width doesn't work

Question 1: Why?

Because it's by default not a block element.

Question 2: How to fix that?

Make it a block element using display: block;, or an inline block by display: inline-block;.



Related Topics



Leave a reply



Submit