How to change an input button image using CSS

If you’re wanting to style the button using CSS, make it a type=”submit” button instead of type=”image”. type=”image” expects a SRC, which you can’t set in CSS. Note that Safari won’t let you style any button in the manner you’re looking for. If you need Safari support, you’ll need to place an image and have … Read more

CSS media queries: max-width OR max-height

Use a comma to specify two (or more) different rules: From https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries Commas are used to combine multiple media queries into a single rule. Each query in a comma-separated list is treated separately from the others. Thus, if any of the queries in a list is true, the entire media statement returns true. In other … Read more

CSS “margin: 0 auto” not centering

It is working. The problem is you’re centering a div, which is a block-level element by default, and which therefore occupies 100% width of its parent (body, in this case). So there’s no space to move horizontally, hence no space to center. For an illustration see this revised demo, which has an added border around … Read more

Child theme css not overriding parent

This problem is most likely caused be CSS selector specificity. Essentially, the parent css rule is more narrowly tailored to hit that element than the rule you’re assigning. You can get your css to take over by using rules that are more specific than the parent css, or use the same rules, in which case … Read more

How to get current screen width in CSS?

I use the following CSS code for formatting when screen width is less than 480px, and it works well. I would like to get the current width for calculation to use zoom like it follows:

How can I move this text up using CSS?

Move s1-text and s2-text inside the .hero class: Add position: relative; to .hero class, so that the absolutely positioned s1-text and s2-text stay inside hero: And then add absolute positioning to the texts like this: Working Demo On Codepen

height style property doesn’t work in div elements

You cannot set height and width for elements with display:inline;. Use display:inline-block; instead. From the CSS2 spec: 10.6.1 Inline, non-replaced elements The height property does not apply. The height of the content area should be based on the font, but this specification does not specify how. A UA may, e.g., use the em-box or the maximum ascender and descender of the font. (The latter would … Read more