Search Results

Search found 12011 results on 481 pages for 'css floating'.

Page 1/481 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Mobile Friendly Websites with CSS Media Queries

    - by dwahlin
    In a previous post the concept of CSS media queries was introduced and I discussed the fundamentals of how they can be used to target different screen sizes. I showed how they could be used to convert a 3-column wide page into a more vertical view of data that displays better on devices such as an iPhone:     In this post I'll provide an additional look at how CSS media queries can be used to mobile-enable a sample site called "Widget Masters" without having to change any server-side code or HTML code. The site that will be discussed is shown next:     This site has some of the standard items shown in most websites today including a title area, menu bar, and sections where data is displayed. Without including CSS media queries the site is readable but has to be zoomed out to see everything on a mobile device, cuts-off some of the menu items, and requires horizontal scrolling to get to additional content. The following image shows what the site looks like on an iPhone. While the site works on mobile devices it's definitely not optimized for mobile.     Let's take a look at how CSS media queries can be used to override existing styles in the site based on different screen widths. Adding CSS Media Queries into a Site The Widget Masters Website relies on standard CSS combined with HTML5 elements to provide the layout shown earlier. For example, to layout the menu bar shown at the top of the page the nav element is used as shown next. A standard div element could certainly be used as well if desired.   <nav> <ul class="clearfix"> <li><a href="#home">Home</a></li> <li><a href="#products">Products</a></li> <li><a href="#aboutus">About Us</a></li> <li><a href="#contactus">Contact Us</a></li> <li><a href="#store">Store</a></li> </ul> </nav>   This HTML is combined with the CSS shown next to add a CSS3 gradient, handle the horizontal orientation, and add some general hover effects.   nav { width: 100%; } nav ul { border-radius: 6px; height: 40px; width: 100%; margin: 0; padding: 0; background: rgb(125,126,125); /* Old browsers */ background: -moz-linear-gradient(top, rgba(125,126,125,1) 0%, rgba(14,14,14,1) 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(125,126,125,1)), color-stop(100%,rgba(14,14,14,1))); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top, rgba(125,126,125,1) 0%, rgba(14,14,14,1) 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, rgba(125,126,125,1) 0%, rgba(14,14,14,1) 100%); /* Opera 11.10+ */ background: -ms-linear-gradient(top, rgba(125,126,125,1) 0%, rgba(14,14,14,1) 100%); /* IE10+ */ background: linear-gradient(top, rgba(125,126,125,1) 0%, rgba(14,14,14,1) 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7d7e7d', endColorstr='#0e0e0e',GradientType=0 ); /* IE6-9 */ } nav ul > li { list-style: none; float: left; margin: 0; padding: 0; } nav ul > li:first-child { margin-left: 8px; } nav ul > li > a { color: #ccc; text-decoration: none; line-height: 2.8em; font-size: 0.95em; font-weight: bold; padding: 8px 25px 7px 25px; font-family: Arial, Helvetica, sans-serif; } nav ul > li a:hover { background-color: rgba(0, 0, 0, 0.1); color: #fff; }   When mobile devices hit the site the layout of the menu items needs to be adjusted so that they're all visible without having to swipe left or right to get to them. This type of modification can be accomplished using CSS media queries by targeting specific screen sizes. To start, a media query can be added into the site's CSS file as shown next: @media screen and (max-width:320px) { /* CSS style overrides for this screen width go here */ } This media query targets screens that have a maximum width of 320 pixels. Additional types of queries can also be added – refer to my previous post for more details as well as resources that can be used to test media queries in different devices. In that post I emphasize (and I'll emphasize again) that CSS media queries only modify the overall layout and look and feel of a site. They don't optimize the site as far as the size of the images or content sent to the device which is important to keep in mind. To make the navigation menu more accessible on devices such as an iPhone or Android the CSS shown next can be used. This code changes the height of the menu from 40 pixels to 100%, takes off the li element floats, changes the line-height, and changes the margins.   @media screen and (max-width:320px) { nav ul { height: 100%; } nav ul > li { float: none; } nav ul > li a { line-height: 1.5em; } nav ul > li:first-child { margin-left: 0px; } /* Additional CSS overrides go here */ }   The following image shows an example of what the menu look like when run on a device with a width of 320 pixels:   Mobile devices with a maximum width of 480 pixels need different CSS styles applied since they have 160 additional pixels of width. This can be done by adding a new CSS media query into the stylesheet as shown next. Looking through the CSS you'll see that only a minimal override is added to adjust the padding of anchor tags since the menu fits by default in this screen width.   @media screen and (max-width: 480px) { nav ul > li > a { padding: 8px 10px 7px 10px; } }   Running the site on a device with 480 pixels results in the menu shown next being rendered. Notice that the space between the menu items is much smaller compared to what was shown when the main site loads in a standard browser.     In addition to modifying the menu, the 3 horizontal content sections shown earlier can be changed from a horizontal layout to a vertical layout so that they look good on a variety of smaller mobile devices and are easier to navigate by end users. The HTML5 article and section elements are used as containers for the 3 sections in the site as shown next:   <article class="clearfix"> <section id="info"> <header>Why Choose Us?</header> <br /> <img id="mainImage" src="Images/ArticleImage.png" title="Article Image" /> <p> Post emensos insuperabilis expeditionis eventus languentibus partium animis, quas periculorum varietas fregerat et laborum, nondum tubarum cessante clangore vel milite locato per stationes hibernas. </p> </section> <section id="products"> <header>Products</header> <br /> <img id="gearsImage" src="Images/Gears.png" title="Article Image" /> <p> <ul> <li>Widget 1</li> <li>Widget 2</li> <li>Widget 3</li> <li>Widget 4</li> <li>Widget 5</li> </ul> </p> </section> <section id="FAQ"> <header>FAQ</header> <br /> <img id="faqImage" src="Images/faq.png" title="Article Image" /> <p> <ul> <li>FAQ 1</li> <li>FAQ 2</li> <li>FAQ 3</li> <li>FAQ 4</li> <li>FAQ 5</li> </ul> </p> </section> </article>   To force the sections into a vertical layout for smaller mobile devices the CSS styles shown next can be added into the media queries targeting 320 pixel and 480 pixel widths. Styles to target the display size of the images in each section are also included. It's important to note that the original image is still being downloaded from the server and isn't being optimized in any way for the mobile device. It's certainly possible for the CSS to include URL information for a mobile-optimized image if desired. @media screen and (max-width:320px) { section { float: none; width: 97%; margin: 0px; padding: 5px; } #wrapper { padding: 5px; width: 96%; } #mainImage, #gearsImage, #faqImage { width: 100%; height: 100px; } } @media screen and (max-width: 480px) { section { float: none; width: 98%; margin: 0px 0px 10px 0px; padding: 5px; } article > section:last-child { margin-right: 0px; float: none; } #bottomSection { width: 99%; } #wrapper { padding: 5px; width: 96%; } #mainImage, #gearsImage, #faqImage { width: 100%; height: 100px; } }   The following images show the site rendered on an iPhone with the CSS media queries in place. Each of the sections now displays vertically making it much easier for the user to access them. Images inside of each section also scale appropriately to fit properly.     CSS media queries provide a great way to override default styles in a website and target devices with different resolutions. In this post you've seen how CSS media queries can be used to convert a standard browser-based site into a site that is more accessible to mobile users. Although much more can be done to optimize sites for mobile, CSS media queries provide a nice starting point if you don't have the time or resources to create mobile-specific versions of sites.

    Read the article

  • CSS issue with elements spanning columns

    - by bigFoot
    Hi folks. Overview: I'm trying to create a relatively simple page layout detailed below and running into problems no matter how I try to approach it. Concept: - A standard-size-block layout. I'll quote unit widths: each content block is 240px square with 5px of margin around it. - A left column of fixed width of 1 unit (245px - 1 block + margin to left). No problems here. - A right column of variable width to fill the remaining space. No problems here either. - In the left column, a number of 1unit x 1unit blocks fixed down the column. Also some blank space at the top - again, not a problem. - In the right column: a number of free-floating blocks of standard unit-sizes which float around and fill the space given to them by the browser window. No problems here. - Lastly, a single element, 2 units wide, which sits half in the left column and half in the right column, and which the blocks in the right column still float around. Here be dragons. Please see here for a diagram: http://is.gd/bPUGI Problem: No matter how I approach this, it goes wrong. Below is code for my existing attempt at a solution. My current problem is that the 1x1 blocks on the right do not respect the 2x1 block, and as a result half of the 2x1 block is overwritten by a 1x1 block in the right-hand column. I'm aware that this is almost certainly an issue with position: absolute taking things out of flow. However, can't really find a way round that which doesn't just throw up another problem instead. Code: <html> <head> <title>wat</title> <style type="text/css"> body { background: #ccc; color: #000; padding: 0px 5px 5px 0px; margin: 0px; } #leftcol { width: 245px; margin-top: 490px; position: absolute; } #rightcol { left: 245px; position: absolute; } #bigblock { float: left; position: relative; margin-top: -240px; background: red; } .cblock { margin: 5px 0px 0px 5px; float: left; overflow: hidden; display: block; background: #fff; } .w1 { width: 240px; } .w2 { width: 485px; } .l1 { height: 240px; } </head> <body> <div class="cblock w2 l1" id="bigblock"> <h1>DRAGONS</h1> <p>Here be they</p> </div> <div id="leftcol"> <div class="cblock w1 l1"> <h1>Left 1</h1> <p>1x1 block</p> </div> </div> <div id="rightcol"> <div class="cblock w1 l1"> <h1>Right 1</h1> <p>1x1 block</p> </div> <div class="cblock w1 l1"> <h1>Right 2</h1> <p>1x1 block</p> </div> <div class="cblock w1 l1"> <h1>Right 3</h1> <p>1x1 block</p> </div> <div class="cblock w1 l1"> <h1>Right 4</h1> <p>1x1 block</p> </div> <div class="cblock w1 l1"> <h1>Right 5</h1> <p>1x1 block</p> </div> <div class="cblock w1 l1"> <h1>Right 6</h1> <p>1x1 block</p> </div> <div class="cblock w1 l1"> <h1>Right 7</h1> <p>1x1 block</p> </div> </div> </body> </html> Constraints: One final note that I need cross-browser compatibility, though I'm more than happy to enforce this with JS if necessary. That said, if a CSS-only solution exists, I'd be extremely happy. Thanks in advance!

    Read the article

  • Stretch and Scale a CSS image Background - With CSS only

    - by Fábio Antunes
    Good day. I always wanted to do this. I want that my background image stretch and scale depending the Browser view port size. I've seen some questions on SO that do the job, this One for example. Works well, but i want place the img in the background way, not with a image tag. In that one is placed a img tag, then with CSS we tribute to the img tag. width:100%; height:100%; It works, but that question is a bit old, and states that in CSS3 resizing a background image will work pretty well. I've tried this example the first one but i didn't workout for me. Does somebody know a good method to do it with the background image statement? If its sounds confusing just ask. Thanks

    Read the article

  • Css code for the table

    - by Hulk
    Can some one please tell me how to make this table look better <table> <tr><th>Name</th><th>Address</th><th>occupation</th></tr> <tr><td><textarea rows=10 cols=15></td><td><textarea rows=10 cols=15></td><td><textarea rows=10 cols=15></td></tr> <tr><td><textarea rows=10 cols=15></td><td><textarea rows=10 cols=15></td><td><textarea rows=10 cols=15></td></tr> <tr><td><textarea rows=10 cols=15></td><td><textarea rows=10 cols=15></td><td><textarea rows=10 cols=15></td></tr> </table> This table is dynamically generated and meaning there could me more rows with td containing textarea. Can any one please sugesst a a css code to beautify this table or may be a link Thanks..

    Read the article

  • Floating DIV's alignment problem.

    - by Rodrigo
    I have a fluid layout with DIV's of different heights and widths, and I'd like them to be aligned by lines, kind of like when you do a search on istockphoto, except aligned to the top: image here--http://i207.photobucket.com/albums/bb121/jpbanks/Capturadepantalla2010-06-02alas1902.png I tried floating all the DIV's to the left, but they are not aligned correctly into lines: image here--http://i207.photobucket.com/albums/bb121/jpbanks/Capturadepantalla2010-06-02alas1900.png See how "Prueba" doesn't go all the way to the left? I thought of the jQuery plugin Masonry but what I want is obviously different. Any solution using either CSS or jQuery would be fine. Any ideas?

    Read the article

  • Directory structure for a website (js/css/img folders)

    - by nightcoder
    For years I've been using the following directory structure for my websites: <root> ->js ->jquery.js ->tooltip.js ->someplugin.js ->css ->styles.css ->someplugin.css ->images -> all website images... it seemed perfectly fine to me until I began to use different 3rd-party components. For example, today I've downloaded a datetime picker javascript component that looks for its images in the same directory where its css file is located (css file contains urls like "url('calendar.png')"). So now I have 3 options: 1) put datepicker.css into my css directory and put its images along. I don't really like this option because I will have both css and image files inside the css directory and it is weird. Also I might meet files from different components with the same name, such as 2 different components, which link to background.png from their css files. I will have to fix those name collisions (by renaming one of the files and editing the corresponding file that contains the link). 2) put datepicker.css into my css directory, put its images into the images directory and edit datepicker.css to look for the images in the images directory. This option is ok but I have to spend some time to edit 3rd-party components to fit them to my site structure. Again, name collisions may occur here (as described in the previous option) and I will have to fix them. 3) put datepicker.js, datepicker.css and its images into a separate directory, let's say /3rdParty/datepicker/ and place the files as it was intended by the author (i.e., for example, /3rdParty/datepicker/css/datepicker.css, /3rdParty/datepicker/css/something.png, etc.). Now I begin to think that this option is the most correct. Experienced web developers, what do you recommend?

    Read the article

  • We Convert your PSD into Xhtml

    - by Aditi
    From last few months we have been receiving a lot of inquires for  Psd into Xhtml projects, while we were majorly focusing on custom WordPress, Magento, Drupal & Joomla Projects. Now we are offering PSD into Xhtml/CSS service at an affordable price looking at its demand. We also will cater PSD into any CMS, like wordpress, Drupal, Magento or Joomla. Our custom services will continue as it is. It is very convenient to get your design converted by our Xhtml & CSS experts. We assure 24 hour delivery time. At JustSkins, we have a structured conversion model that works well for any kind of potentially enriched web business solution. Our customized slicing guidelines, besides, W3C approved XHTML and CSS code naming conventions makes us stand distinct from the competitors. Why Should You Let us do it for you? W3C Compliant HTML/XHTML and CSS Codes Well Structured and Written Code. Clean and Hand Coded Mark up no use of WYSIWYG. We offer Fast turn around timeDesign converted into Xhtml/CSS just in one business day. Multi- Browser Accessible Websites Cross-Platform Support. Excellent Customer Service. Affordable We at JustSkins are team of efficient programmers with vast experience in templating for   content management systems (CMS),  Joomla, Drupal, WordPress and other Open Source technologies. Contact us today for your requirement!

    Read the article

  • Menu floating to the right on IE and to the left in FF

    - by the_drow
    I am working on a website that has a menu which behaves correctly on FF but not on IE (as usuall). On IE it floats to the right while it should float to the left, however if float is set to none it behaves almost correctly, attaching the onto the top of the container. Here's the css: #navigation_wrap { background: url(../images/ltr/nav_bg.png); height: 34px; width: 954px; } .btn_login { float: right; margin: 4px 4px 0 0; } .navigation { float: left; } .navigation ul { list-style: none; margin: 8px 0 0 15px; } .navigation ul li { border-right: 1px solid white; float: left; padding: 0 12px 0 12px; } .navigation ul li.last { border: none; } .navigation ul li a { color: white; font-size: 14px; text-decoration: none; } .navigation ul li a:hover { text-decoration: underline; } .navigation ul li a.active { font-weight: bold; } And here's the html: <div id="navigation_wrap"> <div class="navigation"> <ul> <li><a class="active" href="default.asp">Home Page</a></li> <li><a class="" href="faq.asp">FAQ</a></li><li><a class="" href="articles.asp">Articles</a></li> <li><a class="" href="products.asp">Packages &amp; Pricing</a></li> <li><a class="" href="gp.asp?gpid=15">test1</a></li> <li><a class=" last" href="gp.asp?gpid=17">test asher</a></li> </ul> </div> <div class="btn_login"> ... </div> </div> I hope anyone would have an idea. Thanks, Omer.

    Read the article

  • CSS Sprite techniques, css background or img's clip

    - by Viktor
    Hi, There are two image sprite techniques. The "classic" version uses the background and the background-position css properties. (as it's described here http://www.alistapart.com/articles/sprites) The "second" version uses an image tag and it's clip css property. (http://css-tricks.com/css-sprites-with-inline-images/) My question is that are there advantages of using the "second" version over the "classic" version? thanks and best, Viktor

    Read the article

  • Bootstrap responsive CSS [migrated]

    - by savolai
    I have a four column design and I am using Bootstrap. The design renders fine in a single column in mobile devices, but in "(min-width: 768px) and (max-width: 979px)", I get four columns though there is room for only two. So clearly, the rows/spans setup would need to be rethought for those sizes. The only way I can imagine of doing this is to have semantic CSS classes used in the HTML and only including grid classes in the CSS using LESS, and then depending on screen size, including different grid classes to achieve four or two column layout. Not sure if this would work either though. Is this the way to go with, or am I thinking this too complicatedly? Thanks! Also at: https://groups.google.com/forum/#!topic/twitter-bootstrap/R5jEp0oQ_-E

    Read the article

  • Foundation CSS Framework, how to change triangle on accodion [migrated]

    - by CreateSean
    I'm using foundation framework for the first time and for the most part everything is going smoothly. I am however having some trouble with the accordion in that I need to change the open/close indicator triangle that is in use. You can see it in the docs here. I've looked through the css and found the section with the accordion on foundation.css at lines 709-719 but there is no image to change or adjust. I would like to change this icon to the one in my psd, but just can't figure out where. See attached screenshot for what needs to be changed. I know how to make changes, in this case I just can't find where to make the change.

    Read the article

  • Floating point precision in Visual C++

    - by Luigi Giaccari
    HI, I am trying to use the robust predicates for computational geometry from Jonathan Richard Shewchuk. I am not a programmer, so I am not even sure of what I am saying, I may be doing some basic mistake. The point is the predicates should allow for precise aritmthetic with adaptive floating point precision. On my computer: Asus pro31/S (Core Due Centrino Processor) they do not work. The problem may stay in the fact the my computer may use some improvements in the floating point precision taht conflicts with the one used by Shewchuk. The author says: /* On some machines, the exact arithmetic routines might be defeated by the / / use of internal extended precision floating-point registers. Sometimes / / this problem can be fixed by defining certain values to be volatile, / / thus forcing them to be stored to memory and rounded off. This isn't / / a great solution, though, as it slows the arithmetic down. */ Now what I would like to know is that there is a way, maybe some compiler option, to turn off the internal extended precision floating-point registers. I really appriaciate your help

    Read the article

  • ray collision with rectangle and floating point accuracy

    - by phq
    I'm trying to solve a problem with a ray bouncing on a box. Actually it is a sphere but for simplicity the box dimensions are expanded by the sphere radius when doing the collision test making the sphere a single ray. It is done by projecting the ray onto all faces of the box and pick the one that is closest. However because I'm using floating point variables I fear that the projected point onto the surface might be interpreted as being below in the next iteration, also I will later allow the sphere to move which might make that scenario more likely. Also the bounce coefficient might be as low as zero, making the sphere continue along the surface. So my naive solution is to project not only forwards but backwards to catch those cases. That is where I got into problems shown in the figure: In the first iteration the first black arrow is calculated and we end up at a point on the surface of the box. In the second iteration the "back projection" hits the other surface making the second black arrow bounce on the wrong surface. If there are several boxes close to each other this has further consequences making the sphere fall through them all. So my main question is how to handle possible floating point accuracy when placing the sphere on the box surface so it does not fall through. In writing this question I got the idea to have a threshold to only accept back projections a certain amount much smaller than the box but larger than the possible accuracy limitation, this would only cause the "false" back projection when the sphere hit the box on an edge which would appear naturally. To clarify my original approach, the arrows shown in the image is not only the path the sphere travels but is also representing a single time step in the simulation. In reality the time step is much smaller about 0.05 of the box size. The path traveled is projected onto possible sides to avoid traveling past a thinner object at higher speeds. In normal situations the floating point accuracy is not an issue but there are two situations where I have the concern. When the new position at the end of the time step is located very close to the surface, very unlikely though. When using a bounce factor of 0, here it happens every time the sphere hit a box. To add some loss of accuracy, the motivation for my concern, is that the sphere and box are in different coordinate systems and thus the sphere location is transformed for every test. This last one is why I'm not willing to stand on luck that one floating point value lying on top of the box always will be interpreted the same. I did not know voronoi regions by name, but looking at it I'm not sure how it would be used in a projection scenario that I'm using here.

    Read the article

  • Absolute position and floating

    - by Ruth Rettigo
    Hi, Do you have any idea, how to style this layout without specifing exact height for "Element 1"? Code Element1 { positon: relative; width: 100%; height: auto; /* I don't want to specify exact height */ } Inner1 { position: absolute; top: xyz px; left: xyz px; } Inner2 { position: absolute; top: xyz px; left: xyz px; } Element2 { float: left; width: 100%; } Example +--------------------------------------------------+ |Element1 | | +--------+ | | +--------+ |Inner2 | | | |Inner1 | +--------+ | | +--------+ | | | | | +--------------------------------------------------+ +--------------------------------------------------+ |Element2 | | | | | +--------------------------------------------------+

    Read the article

  • CSS Fluid Grid Layout Problem

    - by Fuego DeBassi
    I have a max-width em based container for my layout. Within it I have many floated fixed width boxes, at 230px to be exact. At the max-width the container will expand to 90em's. This fit's 6 boxes per line perfectly. As the window sizes down and boxes are bumped to lower rows it leaves an ugly gap with the navigation above. I would like to force the container of the boxes to center them at all times. To illustrate: At full width: http://cl.ly/7393a462f44b8315aaba At smaller width: http://cl.ly/ff48a18d39c4f57c3513 How I would like smaller width to work: http://cl.ly/ae9c3fd04df515253b2d (Photoshoped) My markup looks like this: Biodesign Fusce massa felis, laoreet eu elementum sit amet, aliquam ut magna. Etiam et tellus in nisl vehicula ullamcorper. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean nulla ante. Biodesign Fusce massa felis, laoreet eu elementum sit amet, aliquam ut magna. Etiam et tellus in nisl vehicula ullamcorper. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean nulla ante. Biodesign Fusce massa felis, laoreet eu elementum sit amet, aliquam ut magna. Etiam et tellus in nisl vehicula ullamcorper. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean nulla ante. Biodesign Fusce massa felis, laoreet eu elementum sit amet, aliquam ut magna. Etiam et tellus in nisl vehicula ullamcorper. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean nulla ante. Biodesign Fusce massa felis, laoreet eu elementum sit amet, aliquam ut magna. Etiam et tellus in nisl vehicula ullamcorper. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean nulla ante. Biodesign Fusce massa felis, laoreet eu elementum sit amet, aliquam ut magna. Etiam et tellus in nisl vehicula ullamcorper. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean nulla ante. Biodesign Fusce massa felis, laoreet eu elementum sit amet, aliquam ut magna. Etiam et tellus in nisl vehicula ullamcorper. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean nulla ante. My CSS, is: div#bricks { margin:0 auto; background:red; width:100%; } div.brick { background:#181c21; width:230px; margin:0 5px 10px 5px; position:relative; float:left; } div.brick img { background:#666; max-width:230px; } The #bricks is inside a #main, which looks like: div#main { margin:0 auto; padding:0 50px; position:relative; max-width:90em; } Would love some ideas!

    Read the article

  • Floating point equality and tolerances

    - by doron
    Comparing two floating point number by something like a_float == b_float is looking for trouble since a_float / 3.0 * 3.0 might not be equal to a_float due to round off error. What one normally does is something like fabs(a_float - b_float) < tol. How does one calculate tol? Ideally tolerance should be just larger than the value of one or two of the least significant figures. So if the single precision floating point number is use tol = 10E-6 should be about right. However this does not work well for the general case where a_float might be very small or might be very large. How does one calculate tol correctly for all general cases? I am interested in C or C++ cases specifically.

    Read the article

  • Porblem with css on IIS7 (show diffrent css output)

    - by user1300543
    i developed a ASP.NET site in localhost it looks fine and everything looks great on the css http://i.stack.imgur.com/ve1NP.jpg first css good result for some reason when i upload the files to m server and config the IIS application i see this http://i.stack.imgur.com/qmy2A.jpg first bad css result I can't figrue why is it happening to me. the url for the css is <link href='/HerbalifeEMS/Style/Main.css' rel="stylesheet" type="text/css" /> in both computers i checked the IIS, he have the CSS MINE types configure. i tried to seach google but no luck.... can you help me?

    Read the article

  • Simple CSS Scale-Nine Layout

    - by rfkrocktk
    After all these years, I still haven't learned CSS layout, so bear with me. I'm trying to create a container with rounded corners that I generated in Photoshop. The background of the container is white, so I have eight images: top-left-corner, top, top-right-corner, right, bottom-right-corner, bottom, bottom-left-corner, and left. The edges have a drop shadow around them so yes, I do need 8 sides. How would I lay this out in CSS? I tried and failed miserably to do it with a table + CSS. How would I do it using divs?

    Read the article

  • CSS window height problem with dynamic loaded css

    - by Michael Mao
    Hi all: Please go here and use username "admin" and password "endlesscomic" (without wrapper quotes) to see the web app demo. Basically what I am trying to do is to incrementally integrate my work to this web app, say, every nightly, for the client to check the progress. Also, he would like to see, at the very beginning, a mockup about the page layout. I am trying to use the 960 grid system to achieve this. So far, so good. Except one issue that when the "mockup.css" is loaded dynamically by jQuery, it "extends" the window to the bottom, something I do not wanna have... As an inexperienced web developer, I don't know which part is wrong. Below is my js: /* master.js */ $(document).ready(function() { $('#addDebugCss').click(function() { alertMessage('adding debug css...'); addCssToHead('./css/debug.css'); $('.grid-insider').css('opacity','0.5');//reset mockup background transparcy }); $('#addMockupCss').click(function() { alertMessage('adding mockup css...'); addCssToHead('./css/mockup.css'); $('.grid-insider').css('opacity','1');//set semi-background transparcy for mockup }); $('#resetCss').click(function() { alertMessage('rolling back to normal'); rollbackCss(new Array("./css/mockup.css", "./css/debug.css")); }); }); function alertMessage(msg) //TODO find a better modal prompt { alert(msg); } function addCssToHead(path_to_css) { $('<link rel="stylesheet" type="text/css" href="' + path_to_css + '" />').appendTo("head"); } function rollbackCss(set) { for(var i in set) { $('link[href="'+ set[i]+ '"]').remove(); } } Something should be added to the exteral mockup.css? Or something to change in my master.js? Thanks for any hints/suggestions in advance.

    Read the article

  • CSS Dropdown Menu issues

    - by Simon Hume
    Can anyone help with a small problem. I've got a nice simple CSS dropdown menu http://www.cinderellahair.co.uk/new/CSSDropdown.html The problem I have is when you rollover a menu item that has children which are wider than the content, it pushes the whole menu right. Aside of shortening the child menu links down, is there any tweak I can make to my CSS to stop this happening? CSS Code: /* General */ #cssdropdown, #cssdropdown ul { list-style: none; } #cssdropdown, #cssdropdown * { padding: 0; margin: 0; } #cssdropdown {padding:43px 0px 0px 0px;} /* Head links */ #cssdropdown li.headlink { margin:0px 40px 0px -1px; float: left; background-color: #e9e9e9;} #cssdropdown li.headlink a { display: block; padding: 0px 0px 0px 5px; text-decoration:none; } #cssdropdown li.headlink a:hover { text-decoration:underline; } /* Child lists and links */ #cssdropdown li.headlink ul { display: none; text-align: left; padding:10px 0px 0px 0px; font-size:12px; float:left;} #cssdropdown li.headlink:hover ul { display: block; } #cssdropdown li.headlink ul li a { padding: 5px; height: 17px; } #cssdropdown li.headlink ul li a:hover { background-color: #333; } /* Pretty styling */ body { font-family:Georgia, "Times New Roman", Times, serif; font-size: 16px; } #cssdropdown a { color: grey; } #cssdropdown ul li a:hover { text-decoration: none; } #cssdropdown li.headlink { background-color: white; } #cssdropdown li.headlink ul { padding-bottom: 10px;} HTML: <ul id="cssdropdown"> <li class="headlink"><a href="http://www.cinderellahair.co.uk/new/index.php">HOME</a></li> <li class="headlink"><a href="http://www.cinderellahair.co.uk/new/gallery/gallery.php">GALLERY</a> <ul> <li><a href="http://amazon.com/">CELEBRITY</a></li> <li><a href="http://ebay.com/">BEFORE &amp; AFTER</a></li> <li><a href="http://craigslist.com/">HAIR TYPES</a></li> </ul> </li> <li class="headlink"><a href="http://www.cinderellahair.co.uk/new/about-cinderella-hair-extensions/about-us.php">ABOUT US</a> <ul> <li><a href="http://amazon.com/">WHY CHOOSE CINDERELLA</a></li> <li><a href="http://ebay.com/">TESTIMONIALS</a></li> <li><a href="http://craigslist.com/">MINI VIDEO CLIPS</a></li> <li><a href="http://craigslist.com/">OUR HAIR PRODUCTS</a></li> </ul> </li> <li class="headlink"><a href="http://www.cinderellahair.co.uk/new/news-and-offers/news.php">NEWS &amp; OFFERS</a> <ul> <li><a href="http://amazon.com/">VERA WANG FREE GIVEAWAY</a></li> <li><a href="http://ebay.com/">CINDERELLA ON TV</a></li> <li><a href="http://craigslist.com/">CINDERELLA IN THE PRESS</a></li> <li><a href="http://craigslist.com/">CINDRELLA NEWSLETTERS</a></li> </ul> </li> <li class="headlink"><a href="http://www.cinderellahair.co.uk/new/cinderella-salon/salon-finder.php">SALON FINDER</a></li> </ul> JS Code: $(document).ready(function(){ $('#cssdropdown li.headlink').hover( function() { $('ul', this).css('display', 'block'); }, function() { $('ul', this).css('display', 'none'); }); }); Full code is on the link above, just view source.

    Read the article

  • Floating point inaccuracy examples

    - by David Rutten
    How do you explain floating point inaccuracy to fresh programmers and laymen who still think computers are infinitely wise and accurate? Do you have a favourite example or anecdote which seems to get the idea across much better than an precise, but dry, explanation? How is this taught in Computer Science classes?

    Read the article

  • CSS * {margin: 0;padding: 0;} override

    - by StealthRT
    Hey all, i am in need of some help with figuring out how to override the "* {margin: 0;padding: 0;}" in my css. The reason why is that i have this css: .postcomments { width: 547px; padding: 5px 5px 5px 5px; margin: 0 0 5px 0;} .postcomments a { text-decoration: underline;} .postcomments ul { margin: 0; padding: 0; list-style-type: none;} .postcomments ul li { width: 547px; margin: 0 0 5px 0; padding: 0; list-style-type: none;} .postcomments .right { color: #474747; font-size: 11px; background: #fff url('http://www.nextbowluser.com/img/ucBG.gif') no-repeat top left; line-height: 17px; padding: 5px 0 0 0; width: 430px; position: relative; float: right; min-height: 50px;} .postcomments .right .bottom { padding: 0 5px 15px 5px; background: #fff url('http://www.nextbowluser.com/img/ucBG.gif') no-repeat bottom right; min-height: 50px;} .postcomments .arrow { left: -15px; top: 20px; position: absolute;} .avatar { border: none !important;} .postcomments .left {float: left; margin: 0 7px 0 0;} .postcomments .gravatar { background: #fff; width: 80px; height: 60px; margin: 0 0px 0 0; padding: 3px;} .postcomments .name { font-size: 11px; margin: 2px 0 0 0; color: #000;} .avatar { border: none !important;} and it displays just fine WITHOUT the * {margin: 0;padding: 0;}: 1st comment 2nd comment 3rd comment However, when i add that to the CSS, it makes the comments stack wrong: 1st comment 2nd comment 3rd comment I would just take out the * {margin: 0;padding: 0;} but some other things on the page needs that in order for that to be displayed correctly. So my question is, how can i override the {margin: 0;padding: 0;} for just that postcomments part of the page? Thanks! :o) David

    Read the article

  • Are There Specific CSS Selectors Targeting IE10?

    - by kunambi
    Since IE is getting rid of conditional comments in version 10, I'm in dire need to find a "CSS hack" targeting IE10 specifically. NB! It has to be the selector that's getting "hacked" and not the CSS-properties. In Mozilla, you can use: @-moz-document url-prefix() { h1 { color: red; } } While in Webkit, you usually do: @media screen and (-webkit-min-device-pixel-ratio:0) { h1 { color: blue; } } How would I do something similar in IE10? TYIA.

    Read the article

  • Getting this CSS to work in IE6

    - by jerrygarciuh
    Hi folks, Working on this page: http://www.karlsenner.dreamhosters.com/about.php and having trouble with the navigation in IE6. It validates as XHTML 1.0 Transitional. Works great in FF, IE 8, Chrome, and Windows Safari. In IE6 and Opera 10 the drop menus appear too high. I tried adding in the different versions of http://code.google.com/p/ie7-js/ but it did not solve the issue in IE. The CSS looks like this: #wrapper { position: relative; display: block; background-color: inherit; margin: 0px auto; padding: 0; width: 900px; min-height: 900px; } #nav {} .navImage { position:relative; display:inline; height:102px; /* added in hopes of helping IE position but no dice */ } .subMenu { position:absolute; z-index:10; background-color:#FFF; top: 14px; left:0; } .subMenu a:link, .subMenu a:visited, .subMenu a:active{ display:block; width:90%; padding:6px; margin:0; color:#3CF; font-family:Tahoma, Geneva, sans-serif; font-size:14px; text-decoration:none; font-weight:bold; } .subMenu a:hover{ display:block; width:90%; padding:6px; margin:0; color:#3CF; background-color:#CCC; font-family:Tahoma, Geneva, sans-serif; font-size:14px; text-decoration:none; font-weight:bold; } jQuery rollovers: $('#navcompany').hover(function () { $('#companyMenu').css('display', 'block'); $('#companyImg').attr('src','g/nav/company_over.gif'); }, function () { $('#companyMenu').css('display', 'none'); $('#companyImg').attr('src','g/nav/company.gif'); }); And one of the cells. Since the menu is coming out of PHP and IE was not respecting the widths I just use PHP to get the nav image widths and write them to styles on the fly. Solved the width issue as IE acted like they should inherit their width from the wrapper. This may be a clue as to why they don't appear below their nav images but I can't sort it. <div id="navcompany" class="navImage" style="width:128px"> <a href="about.php"> <img src="g/nav/company_over.gif" name="companyImg" width="128" height="102" border="0" id="companyImg" alt="company" /> </a> <div id="companyMenu" class="subMenu" style="display:none; width:128px"> <a href="about.php">About us</a> <a href="location.php">Our location</a> </div> </div> Any advice greatly appreciated! JG

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >