How to make background image with aspect ratio in html and css [closed]
Tags: jquery,html,css
Problem :
I have read many question on stackoverflow but couldn't find better answer for adding image with auto height and width :
here is example what i am trying to do :
visit : http://www.teleclub.ch
In this website when we resize window image auto positioned left and right not exactly resize.
So can any one tell me how i can do this ?
Solution :
background-size:cover
+ background-position:center
actually will do the trick:
JsFiddle (drag the borders around to see)
CSS Howto..
You can do it http://jsfiddle.net/Mohamed_nabil/2efxE/ Just change the background with yours. .fb_iframe_widget iframe{ opacity: 0; } .fb_iframe_widget{ background: #00D6FF;/*Change this with your custom background*/ } ...
Use: background-size: cover; or background-size: 100% auto; The first one will allways cover the whole element, but is css3 (modern browsers only). The second one will always have the full...
Use a CSS style that defines a background-image for the bubble and apply the style to any page element you want to have a bubble. Also define styles to help...
Well... It's more like you set a height on an element that forces the padding to also be calculated in with the height. 1.5em is inclusive of the default padding....
You can use CSS-only but you will spend a lot of time figuring out the numbers for the Bezier, keyframe positions, scale and so on, and on top of that:...
Gice the divs a width / class that has a width, in which only three can fit on (i.e 30% width). That way your browser will only alow 3 on...
You cannot use CSS to limit the number of input characters. That would be a functional restriction, and CSS deals with presentation.
View in JSFiddle Use following jQuery code $(document).ready(function() { $("button").click(function() { $(this).toggleClass("close"); }); }); ...
Do you specify a valid doctype? You can get Internet Explorer to be a bit more compliant by switching it into standards mode. http://msdn.microsoft.com/en-us/library/bb250395.aspx#cssenhancements_topic2 Do you use a browser reset...
Look at your paths.. It must be something with your configuration. You've got your absolute path in code somewhere, either that or it's on track to something related. Search your...
In jQuery Mobile you have the option to use the non native select menu: <span class="stars"> <select id="AddbookConditionSelect" data-native-menu="false" > <option>Please select a condition rating</option> <option value="1" class="staritem">R</option> <option value="2"...
Use display: inline-block. #details { display: inline-block; vertical-align:middle; border:solid black 1px; width: 300px; } .photo { display: inline-block; vertical-align:middle; width: 300px; height: 300px; border: 1px solid #d1c7ac; } ...
UPDATE: I got help from a friend on a different site and using this code instead works: <div class="col col-1-3"> <div class="module" id="img-10"> <img src="img/pic_10.png"> </div> <div class="module" id="img-11"> <img...
If you don't have any other child elements for #dad you can do this. This will trigger the hover when you hover any of the elements #dad { display: inline-block;...
This is what you're looking for: http://www.mailchimp.com/labs/inlinecss.php Hope this helps!...
Would this work? .page:after { content: "copyrighted data"; color: #e7792e; font-size: 14px; position: fixed; bottom: 0; left: 0; right: 0; text-align: center; } ...
Got it!! I found my answer on http://dev.w3.org/html5/html-author/charref It is a table with no cells-per-row <td> defined because each "cell" is a <tr>, and if you try to resize the...
You typed two extra parenthesis. correct version: $(document).on('click', '.dl-menuwrapper li a:only-child', function () {console.log('it works');}); and your css would be like this: .dl-menuwrapper li > a:only-child{ /* some styles */...
Typically You cannot remove properties from built-in objects like that, and certainly not in IE (the zoom attribute of the style object is a IE extension) You can set it...
You have 2 posibilities: background-size: cover; or background-size: contain; The first one will cover all the area, cutting some part of the image. The second one will make the image...
#menu1 { margin: 10px; padding: 10px; width: 220px; text-indent: 27px; font-family: Palatino Linotype; font-size: 15px; -moz-appearance: none; -moz-box-shadow: 0 3px 0 #ccc, 0 -1px #2961c1 inset; box-shadow: 0 3px 0...
You have not provided the end tag of the link tag. Provide it like this. <link rel="stylesheet" href="css/theme_switcher.css" type="text/css" /> <link rel="stylesheet" href="css01/job_blue.responsive.css" title="job_blue" type="text/css" /> OR <link rel="stylesheet" href="css/theme_switcher.css"...
In your gwt.xml file, <set-configuration-property name="CssResource.style" value="pretty" /> See the CssResource docs at http://code.google.com/p/google-web-toolkit/wiki/CssResource#Levers_and_Knobs...
Here are the changes I would make: Position the span using bottom rather than top, so you always have a specific margin between the span and the bottom of the...
Just try border: none; instead of resetting every sub-property. Also, I just checked Bootstrap's selector for pagination and it's more specific than that: .pagination ul > li > a, .pagination...
Use onclick event of the commandLink to execute javascript. Something like <p:commandLink onclick="changeCSSInJavascript()" ...> .... </p:commandLink> ...
Quite easy. Basic html: <div class="header"></div> <div class="main"></div> <div class="footer"></div> and basic css: body, html { height:100%; margin:0; } .header, .footer { height:30px; background-color:black; width:100%; } .main { height:calc(100% -...
How about this? http://codepen.io/Leth0_/pen/meJCH I'm not familiar with SCSS so forgive me for just using CSS. I basicly toggle visibility state of the added div on hover of the parent....
Hey i think you should do this Define float properties in your socail icon and define margin padding width height according to your design Css .social{ float:right; border:solid 1px green;...
You are looking for jQuery stopPropagation method which prevents to event bubbling. $(document).on('click', 'div', function(event) { event.stopPropagation(); console.log($(this)); $('div').removeClass('exit'); $(this).addClass('exit'); }); ...