css3

How to set CSS3 transition using javascript?

限于喜欢 提交于 2019-12-27 22:05:46
问题 How can I set CSS using javascript (I don't have access to the CSS file)? #fade div { -webkit-transition: opacity 1s; -moz-transition: opacity 1s; -o-transition: opacity 1s; -ms-transition: opacity 1s; transition: opacity 1s; opacity: 0; position: absolute; height: 500px; width: 960px; } For example: document.getElementById('fade').HOW-TO-TYPE-webkit-transition = 'opacity 1s'; 回答1: You should look here: http://www.javascriptkit.com/javatutors/setcss3properties.shtml As you can see setting CSS

CSS @font-face not working in ie

☆樱花仙子☆ 提交于 2019-12-27 22:04:46
问题 I have the following CSS that works within Firefox but not IE. Obviously, the fonts are within the directory. Any suggestions? @font-face { font-family: "Futura"; src: url("../fonts/Futura_Medium_BT.eot"); /* IE */ src: local("Futura"), url( "../fonts/Futura_Medium_BT.ttf" ) format("truetype"); /* non-IE */ } body nav { font-family: Futura, Verdana, Arial, sans-serif; font-size:1.2em; height: 40px; } 回答1: I read a lot of tutorials that suggested hacks, so I came up with this solution I think

Can I fade in a background image (CSS: background-image) with jQuery?

谁说我不能喝 提交于 2019-12-27 19:12:48
问题 I have a div element with text in it and a background image, which is set via the CSS property background-image . Is it possible to fade in the background image via jQuery? div { background-repeat: no-repeat; background-position: center; background-size: contain; background-image: url(http://upload.wikimedia.org/wikipedia/commons/8/84/Konqi_svg.svg); border: 1px solid #666; height: 10em; } <div>Text</div> EDIT I've made a fiddle exemplifying my scenario. Basically, this configures an initial

Flexbox: wrong width calculation when flex-direction: column, flex-wrap: wrap

試著忘記壹切 提交于 2019-12-27 17:57:50
问题 I ran into a problem when using flexbox. I'm using a container with flex-direction: column; flex-wrap: wrap , so my inner items can actually be placed in multiple columns. The problem is that the browser still calculates the container's width as a sum of inner items' widths ! My container block should have a smaller width (based on content size), but it is actually huge. Anyway, it's also very unnatural to calculate container's width this way when using columns, not rows. Take a look at the

How To Isolate a div from public CSS styles?

大憨熊 提交于 2019-12-27 17:02:34
问题 i have some code for example here in html <html> <body> <img src='an image source'/> <h1>Hi it's test</h1> <div id='mydiv'> <img src='an image source'/> <h1>Hi it's test</h1> </div> </body> </html> if i used the following css code for styling it: img{ width:100px; height:100px; } h1{ font-size:26px; color:red; } the question is : How can i prevent and isolate the tags inside the mydiv div tag from styling by the public tags style ? 回答1: CSS Cascading and Inheritance Level 3 introduces the all

Padding-bottom/top in flexbox layout

ぃ、小莉子 提交于 2019-12-27 16:50:10
问题 I have a flexbox layout containing two items. One of them uses padding-bottom : #flexBox { border: 1px solid red; width: 50%; margin: 0 auto; padding: 1em; display: flex; flex-direction: column; } #text { border: 1px solid green; padding: .5em; } #padding { margin: 1em 0; border: 1px solid blue; padding-bottom: 56.25%; /* intrinsic aspect ratio */ height: 0; } <div id='flexBox'> <div id='padding'></div> <div id='text'>Some text</div> </div> The blue element maintains its aspect ratio

Padding-bottom/top in flexbox layout

末鹿安然 提交于 2019-12-27 16:49:44
问题 I have a flexbox layout containing two items. One of them uses padding-bottom : #flexBox { border: 1px solid red; width: 50%; margin: 0 auto; padding: 1em; display: flex; flex-direction: column; } #text { border: 1px solid green; padding: .5em; } #padding { margin: 1em 0; border: 1px solid blue; padding-bottom: 56.25%; /* intrinsic aspect ratio */ height: 0; } <div id='flexBox'> <div id='padding'></div> <div id='text'>Some text</div> </div> The blue element maintains its aspect ratio

How do I add a “search” button in a text input field?

不羁的心 提交于 2019-12-27 14:44:14
问题 How do I create a similar “search” element to the one in this site? If we view source, he has one textbox followed by a <span> tag. <input type="text" name="q" id="site-search-input" autocomplete="off" value="Search" class="gray" /> <span id="g-search-button"></span> Where do I get a similar "magnifying glass" image? 回答1: Put the image into the span, for example using background-image , then give it a relative position and move it to the left so it overlaps the right end of the search box,

How do I add a “search” button in a text input field?

时间秒杀一切 提交于 2019-12-27 14:43:34
问题 How do I create a similar “search” element to the one in this site? If we view source, he has one textbox followed by a <span> tag. <input type="text" name="q" id="site-search-input" autocomplete="off" value="Search" class="gray" /> <span id="g-search-button"></span> Where do I get a similar "magnifying glass" image? 回答1: Put the image into the span, for example using background-image , then give it a relative position and move it to the left so it overlaps the right end of the search box,

How do I add a “search” button in a text input field?

假装没事ソ 提交于 2019-12-27 14:43:14
问题 How do I create a similar “search” element to the one in this site? If we view source, he has one textbox followed by a <span> tag. <input type="text" name="q" id="site-search-input" autocomplete="off" value="Search" class="gray" /> <span id="g-search-button"></span> Where do I get a similar "magnifying glass" image? 回答1: Put the image into the span, for example using background-image , then give it a relative position and move it to the left so it overlaps the right end of the search box,