Search Results

Search found 922 results on 37 pages for 'h2'.

Page 6/37 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • jquery, moving the current item to the top

    - by azz0r
    Hello, The problem I'm having is that if the fourth item has a long description, it cuts off as it goes below #features. What I was hoping is someone would have a suggestion on how to make the current item selected to move to the top? Code below: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" src="/library/jquery/1.4.js"></script> <script> Model.FeatureBar = { current:0, items:{}, init: function init(options){ var me = this; me.triggers = [] me.slides = [] this.container = jQuery('#features'); jQuery('.feature').each(function(i){ me.triggers[i] = {url: jQuery(this).children('.feature-title a').href, title: jQuery(this).children('.feature-title'),description:jQuery(this).children('.feature-description')} me.slides[i] = {image: jQuery(this).children('.feature-image')} }); for(var i in this.slides){ this.slides[i].image.hide(); this.triggers[i].description.hide(); } Model.FeatureBar.goToItem(0); setInterval(function(){Model.FeatureBar.next()},5000); }, next: function next(){ var i = (this.current+1 < this.triggers.length) ? this.current+1 : 0; this.goToItem(i); }, previous: function previous(){ var i = (this.current-1 > 1) ? this.current-1 : this.triggers.length; this.goToItem(i); }, goToItem: function goToItem(i) { if (!this.slides[i]) { throw 'Slide out of range'; } this.triggers[this.current].description.slideUp(); this.triggers[i].description.slideDown(); this.slides[this.current].image.hide(); this.slides[i].image.show(); this.current = i; }, } </script> </head> <body> <div id="features"> <div class="feature current"> <div style="display: none;" class="feature-image"> <a href="google.com"><img src="/design/images/four-oh-four.png"></a> </div> <h2 class="feature-title"><a href="google.com">Item 3</a></h2> <p style="display: none;" class="feature-description"><a href="google.com">Item 3 description</a></p> </div> <div class="feature"> <div class="movie-cover"> <a href="/movie/movie"><img src="/image1" alt="" title=""></a> </div> <div style="display: block;" class="feature-image"> <a href="/rudeboiz-14-arse-splitters/movie"><img src="/images/Featured/rude.png"></a> </div> <h2 class="feature-title"><a href="/rude/movie">Item 2</a></h2> <p style="display: block;" class="feature-description"><a href="/rude/movie">Item 2 description</a></p> </div> <div class="feature"> <div style="display: none;" class="feature-image"> <a href="/pissed-up-brits/movie"><img src="/design/images/four-oh-four.png"></a> </div> <h2 class="feature-title"><a href="/pis/movie">Item 1</a></h2> <p style="display: none;" class="feature-description"><a href="/pis/movie">Item one description</a></p> </div> <div class="feature"> <div style="display: none;" class="feature-image"> <a href="what.com"><img src="/images/Featured/indie.png"></a> </div> <h2 class="feature-title"><a href="what.com">Item 4</a></h2> <p style="display: none;" class="feature-description"><a href="what.com">Item 4 description</a></p> </div> </div> </body> </html>

    Read the article

  • jQuery featured content slider

    - by azz0r
    Hello, I have a content area that loops through divs and shows there content. I'm having trouble making it display the initial content, unfortunately it waits 5000 milliseconds before triggering the very first content area to display. Anyone spot an easy way to make it display the initial area, then slide to the next area and do them at 5000 milliseconds. JS Model.FeatureBar = { current:0, items:{}, init: function init(options){ var me = this; me.triggers = [] me.slides = [] this.container = jQuery('#features'); jQuery('.feature').each(function(i){ me.triggers[i] = {url: jQuery(this).children('.feature-title a').href, title: jQuery(this).children('.feature-title'),description:jQuery(this).children('.feature-description')} me.slides[i] = {image: jQuery(this).children('.feature-image')} }); for(var i in this.slides){ this.slides[i].image.hide(); this.triggers[i].description.hide(); } setInterval(function(){Model.FeatureBar.next()},5000); }, next: function next(){ var i = (this.current+1 < this.triggers.length) ? this.current+1 : 0; this.goToItem(i); }, previous: function previous(){ var i = (this.current-1 > 1) ? this.current-1 : this.triggers.length; this.goToItem(i); }, goToItem: function goToItem(i){ if(!this.slides[i]) throw 'Slide out of range'; this.triggers[this.current].description.slideUp(); this.triggers[i].description.slideDown(); this.slides[this.current].image.hide(); this.slides[i].image.show(); this.current = i; }, } html <div id="features"> <div class="feature current"> <div class="movie-cover"> <a href="/police/movie"><img title="" alt="" src="/design/images/four-oh-four.png"></a> </div> <div class="feature-image" style="display: none;"> <img src="/design/images/four-oh-four.png"> </div> <h2 class="feature-title"><a href="/police/movie">Police</a></h2> <p class="feature-description" style="overflow: hidden; display: block; height: 50.8604px; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px;">DESCRIPTION</p> </div> <div class="feature"> <div class="movie-cover"> <a href="/rude/movie"><img title="" alt="" src="/design/images/four-oh-four.png"></a> </div> <div class="feature-image" style="display: none;"> <img src="/design/images/four-oh-four.png"> </div> <h2 class="feature-title"><a href="/rude/movie">Rude</a></h2> <p class="feature-description" style="overflow: hidden; display: block; height: 18.3475px; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px;">DESCRIPTION</p> </div> <div class="feature"> <div class="movie-cover"> <a href="/brits/movie"><img title="" alt="" src="/design/images/four-oh-four.png"></a> </div> <div class="feature-image" style="display: block;"> <img src="/design/images/four-oh-four.png"> </div> <h2 class="feature-title"><a href="/brits/movie">Brits</a></h2> <p class="feature-description" style="overflow: hidden; display: block; height: 40.1549px; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px;">DESCRIPTION</p> </div> <div class="feature"> <div class="movie-cover"> <a href="/indie/movie"><img title="" alt="" src="/design/images/four-oh-four.png"></a> </div> <div class="feature-image" style="display: none;"> <img src="/design/images/four-oh-four.png"> </div> <h2 class="feature-title"><a href="/indie/movie">Indie</a></h2> <p class="feature-description" style="overflow: hidden; display: block; height: 42.4247px; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px;">DESCRIPTION</p> </div>

    Read the article

  • Cloning a selector + all its children in jQuery?

    - by HipHop-opatamus
    I'm having trouble getting the following JQuery script to function properly - its functionality is as follows: 1) Hide the content below each headline 2) Upon clicking a headline, substitute the "#first-post" with the headline + the hidden content below the headline. I can only seem to get the script to clone the headline itself to #first-post, not the headline + the content beneath it. Any idea why? <HTML> <HEAD> <script src="http://code.jquery.com/jquery-latest.js"></script> </HEAD> <script> $(document).ready( function(){ $('.title').siblings().hide(); $('.title').click( function() { $('#first-post').replaceWith($(this).closest(".comment").clone().attr('id','first-post')); $('html, body').animate({scrollTop:0}, 'fast'); return false; }); }); </script> <BODY> <div id="first-post"> <div class="content"><p>This is a test discussion topic</p> </div> </div> <div class="comment"> <h2 class="title"><a href="#1">1st Post</a></h2> <div class="content"> <p>this is 1st reply to the original post</p> </div> <div class="test">1st post second line</div> </div> <div class="comment"> <h2 class="title"><a href="#2">2nd Post</a></h2> <div class="content"> <p>this is 2nd reply to the original post</p> </div> <div class="test">2nd post second line</div> </div> </div> <div class="comment"> <h2 class="title"><a href="#3">3rd Post</a></h2> <div class="content"> <p>this is 3rd reply to the original post</p> </div> <div class="test">3rd post second line</div> </div> </div> </BODY> </HTML>

    Read the article

  • JQuery delegate what may cause it to not function

    - by Jafin
    I have a webpage using jquery 1.42 The following 2 segments of code live in my page. $('body').delegate('h2', 'click', function() { $(this).after("<p>delegate paragraph!<\/p>"); }); $('body h2').live('click', function() { $(this).after("<p>live paragraph!<\/p>"); }); The live method always works, yet the delegate doesn't fire at all. If I create a trivial page with simple html <body><h2>blah</h2></body> both approaches work. So I'm assuming there is something else going on in my page. With firebug I am seeing no javascript errors, no html errors. and breakpoints on the delegate method definately do not get hit. What else might be the cause of delegate not triggering?

    Read the article

  • Java static method parameters

    - by Blitzkr1eg
    Why does the following code return 100 100 1 1 1 and not 100 1 1 1 1 ? public class Hotel { private int roomNr; public Hotel(int roomNr) { this.roomNr = roomNr; } public int getRoomNr() { return this.roomNr; } static Hotel doStuff(Hotel hotel) { hotel = new Hotel(1); return hotel; } public static void main(String args[]) { Hotel h1 = new Hotel(100); System.out.print(h1.getRoomNr() + " "); Hotel h2 = doStuff(h1); System.out.print(h1.getRoomNr() + " "); System.out.print(h2.getRoomNr() + " "); h1 = doStuff(h2); System.out.print(h1.getRoomNr() + " "); System.out.print(h2.getRoomNr() + " "); } } Why does it appear to pass Hotel by-value to doStuff() ?

    Read the article

  • PHP Global variable in class is reset

    - by Robert
    I have a web form that manipulates records in a MySQL database. I have a method for displaying an edit interface for both creating new records and editing them if ($_POST['new_page']) { print "<h2>Create new page</h2>\n"; $isNew=1; $this->EditForm(); } else if($_POST['edit']){ print "<h2>Edit page</h2>\n"; $isNew=0; $this->EditForm(); } I am trying to use the global variable $isNew to determine where a record is to be added or updated. However, whenever my SaveChanges() function is run, $isNew is always 0. $isNew is declared immediately after the class declaration, outside all of the functions. class Editor{ public $isNew;

    Read the article

  • angularjs model view update through angular directive

    - by Relicset
    I am trying to update my view using model in angular directive here is the directive I have created app.directive('aboutOptions', [function() { return { restrict: 'C', scope: { testing: '=' }, transclude: true, link: function(scope, elem, attr) { scope.$watch(attr.ngModel, function() { console.log(scope.$eval(attr.ngModel)); scope.testing = scope.$eval(attr.ngModel); }); } } }]); here is html model and file name is ab.html <input type="text" class="about-options" ng-model="testing" /> Here is the view to be updated and file name is show.html <h2 class="about-options">{{testing}}</h2> ab.html file will be loaded as a template inside jquery ui dialog and my show.html file is in main page If I remove scope: { testing: '=' }, Console is showing what I am typing Update - 1 Tried with the following changes testing: '=test' And in html <input type="text" class="about-options" ng-model="testing" /> <h2 class="about-options">{{test}}</h2>

    Read the article

  • H1 tags, SEO and semantics

    - by dazhall
    Hi guys, I'm using the H1 tag in my document as the main title, as you do. The text in the H1 is the title of the company, which needs to be shown on every page. I'm using the H2 tag for the title of the main content on each page. So the H1 is the same on every page, and the H2 changes. I know that a lot of sites use the H1 to do what I'm doing with the H2, am I losing out by not doing this? I know that semantically I can't make the H1 into a H2 and vice versa, so I'm wondering what the best option is. Does it matter that my H1 is always the same? Any advice is appreciated! Thanks! Darren.

    Read the article

  • stick element to top of page until next element of that type appears

    - by aharon
    I'm having a hard time giving a good description of this, but bear with me: If I have a page structed like this <h2>Chapter 1</h2> <p>Lots of text that has mutiple screen worths of content</p> <h2>Chapter 2</h2> <p>Lots of text...</p> I'd like to have "Chapter 1" absolutely positioned or whatever at the top of the page until the user scrolls down to where "Chapter 2" starts, at which point now "Chapter 2" is displayed at the top of the page. We can add wrapper classes and divs if needed. Solutions that use JQuery would be great.

    Read the article

  • Surely eAsy but I am not able ... JQUERY UI - WIDGET - HEADER

    - by alex
    I was making this simple trial, but can anyone tell me why the distance from the border of DIV to the H2 header is so much ? How can I reduce it ? I don't want space ... Prova WIDGET <link rel="stylesheet" href="jquery-ui-1.8.custom/css/smoothness/jquery-ui-1.8.custom.css" type="text/css"> <link rel="stylesheet" href="jquery-ui-1.8.custom/development-bundle/ui/jquery-ui-1.8.custom.css" type="text/css"> <script src="jquery-ui-1.8.custom/development-bundle/jquery-1.4.2.js" type="text/javascript"></script> <script src="jquery-ui-1.8.custom/js/jquery-ui-1.8.custom.min.js" type="text/javascript"></script> <script type="text/javascript"> $(themify); function themify(){ $("div").addClass("ui-widget ui-widget-content ui-corner-all"); $("input").addClass("ui-button ui-button-text"); $(":header").addClass("ui-widget-header ui-corner-all"); //ui-widget } </script> <style>#test{display:none}</style> <script type="text/javascript"> function rendiVisibile(){ if(document.getElementById("test").style.display = "none"){ $("#test").css({"width":"200px","float":"right","text-align":"center"}); $("#test").show("slide",{},1000); } } </script> </head> <body> <h2>Tentativo widget con DIV</h2> <form action=""> <input type="button" value="Submit" id="pulsante" onclick="rendiVisibile()";><br/></br> <div id="test"> <h2>CIAO</h2> Un saluto </div> </form> </body>

    Read the article

  • C# drawing and invalidating 2 lines to meet

    - by BlueMonster
    If i have 2 lines on a page as such: e.Graphics.DrawLine(blackPen, w, h, h, w); e.Graphics.DrawLine(blackPen, w2, h2, h2, w2); how would i animate the first line to reach the second line's position? I have the following method which calculates the distance between two points (i'm assuming i would use this?) public int Distance2D(int x1, int y1, int x2, int y2) { // ______________________ //d = &#8730; (x2-x1)^2 + (y2-y1)^2 // //Our end result int result = 0; //Take x2-x1, then square it double part1 = Math.Pow((x2 - x1), 2); //Take y2-y1, then sqaure it double part2 = Math.Pow((y2 - y1), 2); //Add both of the parts together double underRadical = part1 + part2; //Get the square root of the parts result = (int)Math.Sqrt(underRadical); //Return our result return result; } How would i re-draw the line (on a timer) to reach the second line's position? I've looked a lot into XAML (story-boarding) and such - but i want to know how to do this on my own. Any ideas? I know i would need a method which runs in a loop re-drawing the line after moving the position a tid bit. I would have to call Invalidate() in order to make the line appear as though it's moving... but how would i do this? how would i move that line slowly over to the other line? I'm pretty sure i'd have to use double buffering if i'm doing this as well... as such: SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); This doesn't quiet work, i'm not quiet sure how to fix it. Any ideas? protected override void OnPaint(PaintEventArgs e) { Distance2D(w, h, w2, h2); if (w2 != w && h2 != h) { e.Graphics.DrawLine(blackPen, (w * (int)frame), (h * (int)frame), (h * (int)frame), (w * (int)frame)); e.Graphics.DrawLine(blackPen, w2, h2, h2, w2); } else { t.Abort(); } base.OnPaint(e); } public void MoveLine() { for (int i = 0; i < 126; i++) { frame += .02; Invalidate(); Thread.Sleep(30); } } private void button1_Click(object sender, EventArgs e) { t = new Thread(new ThreadStart(MoveLine)); t.Start(); }

    Read the article

  • Google Maps and jQuery Tabs

    - by Dom
    Hello All, I have slight problem with Google maps included in simple jQuery Tabs. Below I pasted the code: jQuery: $(document).ready(function() { //Default Action $(".tab_content").hide(); $("ul.tabs li:first").addClass("active").show(); $(".tab_content:first").show(); //On Click Event $("ul.tabs li").click(function() { $("ul.tabs li").removeClass("active"); $(this).addClass("active"); $(".tab_content").hide(); var activeTab = $(this).find("a").attr("href"); $(activeTab).fadeIn(); return false; }); }); Here is the HTML for the tabs: <div class="bluecontainer"> <ul class="tabs"> <li><a href="#tab1">Tab1</a></li> <li><a href="#tab2">Tab2</a></li> <li><a href="#tab3">Tab3</a></li> <li><a href="#tab4">Tab4</a></li> </ul> <div class="tab_container"> <div id="tab1" class="tab_content"> <h2>Tab1</h2> </div> <div id="tab2" class="tab_content"> <h2>Tab2</h2> </div> <div id="tab3" class="tab_content"> <div>google Map</div> </div> <div id="tab4" class="tab_content"> <h2>Tab4</h2> </div> </div> </div> I really don't know what to do to. Is that a general problem with google maps or there is something with my tabs? But they are working just fine with everything else. Thank you for your help in advance

    Read the article

  • layout is not included in all pages in asp.net mvc4 application

    - by Ahmed
    I am developing an asp.net mvc4 application with Bootstrap 3 and i've _Layout.cshtml in "Shared" folder , in Views, i've two pages, "Index and "Register" and i've included Layout in both of these Views but It seems that Layout is included in only "Index and not in "Register" View. Following are my Index and Register Views @{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Layout.cshtml"; } <h2 align="center" class="bg-info">Login</h2> <form class="form-horizontal" role="form"> <div class="form-group"> <label for="inputEmail3" class="col-sm-2 control-label"><strong>UserName : </strong></label> <div class="col-sm-10"> <input type="email" class="form-control" id="inputEmail3" placeholder="UserName"> </div> </div> <div class="form-group"> <label for="inputPassword3" class="col-sm-2 control-label"><strong>Password</strong></label> <div class="col-sm-10"> <input type="password" class="form-control" id="inputPassword3" placeholder="Password"> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <div class="checkbox"> <label> <input type="checkbox"> Remember me </label> </div> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button type="submit" class="btn btn-primary">Sign in</button> </div> </div> <h2 align="center" class="bg-info">SignIn With Other Services</h2> </form> <form class="form-horizontal" role="form" method="post" action="/Home/FacebookLogin"> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button type="submit" class="btn btn-primary">SignIn with Facebook</button> </div> </div> </form> <h2 align="center" class="bg-info">Don't Have an Account?</h2> <form class="form-horizontal" role="form" method="post" action="/Home/Register"> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button type="submit" class="btn btn-primary">Register</button> </div> </div> </form> ![@{ ViewBag.Title = "Register"; Layout = "~/Views/Shared/_Layout.cshtml"; } <h2 align="center" class="bg-info">Register</h2> <form class="form-horizontal" role="form"> <div class="form-group"> <label for="inputEmail3" class="col-sm-2 control-label"><strong>UserName : </strong></label> <div class="col-sm-10"> <input type="email" class="form-control" id="uname" name="uname" placeholder="UserName"> <input type="button" class="btn btn-primary" id="check" value="Check Availability" > <h4 class="bg-warning"></h4> </div> </div> <div class="form-group"> <label for="inputPassword3" class="col-sm-2 control-label"><strong>Password</strong></label> <div class="col-sm-10"> <input type="password" class="form-control" id="upass" name="upass" placeholder="Password"> </div> </div> <div class="form-group"> <label for="inputPassword3" class="col-sm-2 control-label"><strong>Retype Password</strong></label> <div class="col-sm-10"> <input type="password" class="form-control" id="retype" placeholder="Password"> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button type="submit" class="btn btn-primary">Register</button> </div> </div> </form>]

    Read the article

  • Is there any tool which can rearrange the css based on same type selector?

    - by metal-gear-solid
    I've big css where selector for same things are on different place. Is there any tool which can rearrange the css based on same type selector? This is just example. #main h2 { font-size: 2em; } #sidebar h3 { font-size: 2em; } #main h1 { font-size: 3em; } #sidebar h4 { font-size: 1.6em; } #main #box h2 { font-size: 2em; } #sidebar ul li { font-size: 1em; } it should arranged like this #main h1 { font-size: 3em; } #main h2 { font-size: 2em; } #main #box h2 { font-size: 2em; } #sidebar h3 { font-size: 2em; } #sidebar h4 { font-size: 1.6em; } #sidebar ul li { font-size: 1em; } if parent selector is same then all should be at same place.

    Read the article

  • Easiest way to submit data via PHP?

    - by Abijah
    I'm new to PHP, and have spent 10 hours trying to figure this problem out. The goal is to take all data entered into this order form, and send it to my email via PHP. I have 2 questions: 1. I can get PHP to send data from a single menu item (example: Mexican Tortas), but how do I get PHP to send data from multiple items (example: Mexican Tortas, Fish Sandwich and Hamburger)? 2. How do I tell PHP to not send data from menu items that don't have the "How Many?" or "Customize It?" text fields filled out? If you could provide a super simple example (or a link to a learning resource) I would really appreciate it. Thank you, Abijah PHP <?php if(isset($_POST['submit'])) { $to = "[email protected]"; $subject = "New Order"; $name_field = $_POST['name']; $phone_field = $_POST['phone']; $item = $_POST['item']; $quantity = $_POST['quantity']; $customize = $_POST['customize']; } $body = "Name: $name_field\nPhone: $phone_field\n\nItem: $item\nQuantity: $quantity\nCustomize: $customize"; echo "Data has been submitted to $to!"; mail($to, $subject, $body); ?> HTML <form action="neworder.php" method="POST"> <div class ="item"> <img style="float:left; margin-right:15px; border:1px Solid #000; width:200px; height:155px;" src="images/mexicantortas.jpg"> <h1>Mexican Torta - $8.50</h1> <input name="item" type="hidden" value="Mexican Torta"/> <h2>How Many? <font color="#999999">Ex: 1, 2, 3...?</font></h2> <input name="quantity" type="text"/> <h3>Customize It? <font color="#999999">Ex: No Lettuce, Extra Cheese...</font></h3> <textarea name="customize"/></textarea> </div><!-- ITEM_LEFT --> <div class ="item"> <img style="float:left; margin-right:15px; border:1px Solid #000; width:200px; height:155px;" src="images/fishsandwich.jpg"> <h1>Fish Sandwich - $8.50</h1> <input name="item" type="hidden" value="Fish Sandwich"/> <h2>How Many? <font color="#999999">Ex: 1, 2, 3...?</font></h2> <input name="quantity" type="text"/> <h3>Customize It? <font color="#999999">Ex: No Lettuce, Extra Cheese...</font></h3> <textarea name="customize"/></textarea> </div><!-- ITEM_LEFT --> <div class ="item"> <img style="float:left; margin-right:15px; border:1px Solid #000; width:200px; height:155px;" src="images/hamburgers.jpg"> <h1>Hamburger w/ Fries - $7.00</h1> <input name="item" type="hidden" value="Fish Sandwich"/> <h2>How Many? <font color="#999999">Ex: 1, 2, 3...?</font></h2> <input name="quantity" type="text"/> <h3>Customize It? <font color="#999999">Ex: No Lettuce, Extra Cheese...</font></h3> <textarea name="customize"/></textarea> </div><!-- ITEM_LEFT --> <div class="horizontal_form"> <div class="form"> <h2>Place Your Order Now: <font size="3"><font color="#037B41">Fill in the form below, and we'll call you when your food is ready to be picked up...</font></font></h2> <p class="name"> <input type="text" name="name" id="name" style="text-align:center;" onClick="this.value='';" value="Enter your name"/> </p> <p class="phone"> <input type="text" name="phone" id="phone" style="text-align:center;" onClick="this.value='';" value="Enter your phone #"/> </p> <p class="submit"> <input type="submit" value="Place Order" name="submit"/> </p> </div><!-- FORM --> </div><!-- HORIZONTAL_FORM --> </form>

    Read the article

  • Using multiple column layout with HTML 5 and CSS 3

    - by nikolaosk
    This is going to be the fourth post in a series of posts regarding HTML 5. You can find the other posts here , here and here.In this post I will provide a hands-on example with HTML 5 and CSS 3 on how to create a page with multiple columns and proper layout.I will show you how to use CSS 3 to create columns much easier than relying on DIV elements and the float CSS rule.I will also show you how to use browser-specific prefix rules (-ms for Internet Explorer and -moz for Firefox ) for browsers that do not fully support CSS 3.In order to be absolutely clear this is not (and could not be) a detailed tutorial on HTML 5. There are other great resources for that.Navigate to the excellent interactive tutorials of W3School.Another excellent resource is HTML 5 Doctor.Two very nice sites that show you what features and specifications are implemented by various browsers and their versions are http://caniuse.com/ and http://html5test.com/. At this times Chrome seems to support most of HTML 5 specifications.Another excellent way to find out if the browser supports HTML 5 and CSS 3 features is to use the Javascript lightweight library Modernizr.In this hands-on example I will be using Expression Web 4.0.This application is not a free application. You can use any HTML editor you like.You can use Visual Studio 2012 Express edition. You can download it here.I will create a simple page with information about HTML 5, CSS 3 and JQuery. This is the full HTML 5 code. <!DOCTYPE html><html lang="en">  <head>    <title>HTML 5, CSS3 and JQuery</title>    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >    <link rel="stylesheet" type="text/css" href="style.css">       </head>  <body>    <div id="header">      <h1>Learn cutting edge technologies</h1>      <p>HTML 5, JQuery, CSS3</p>    </div>    <div id="main">      <div id="mainnews">        <div>          <h2>HTML 5</h2>        </div>        <div>          <p>            HTML5 is the latest version of HTML and XHTML. The HTML standard defines a single language that can be written in HTML and XML. It attempts to solve issues found in previous iterations of HTML and addresses the needs of Web Applications, an area previously not adequately covered by HTML.          </p>          <div class="quote">            <h4>Do More with Less</h4>            <p>             jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development.             </p>            </div>          <p>            The HTML5 test(html5test.com) score is an indication of how well your browser supports the upcoming HTML5 standard and related specifications. Even though the specification isn't finalized yet, all major browser manufacturers are making sure their browser is ready for the future. Find out which parts of HTML5 are already supported by your browser today and compare the results with other browsers.                      The HTML5 test does not try to test all of the new features offered by HTML5, nor does it try to test the functionality of each feature it does detect. Despite these shortcomings we hope that by quantifying the level of support users and web developers will get an idea of how hard the browser manufacturers work on improving their browsers and the web as a development platform.</p>        </div>      </div>              <div id="CSS">        <div>          <h2>CSS 3 Intro</h2>        </div>        <div>          <p>          Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation semantics (the look and formatting) of a document written in a markup language. Its most common application is to style web pages written in HTML and XHTML, but the language can also be applied to any kind of XML document, including plain XML, SVG and XUL.          </p>        </div>      </div>            <div id="CSSmore">        <div>          <h2>CSS 3 Purpose</h2>        </div>        <div>          <p>            CSS is designed primarily to enable the separation of document content (written in HTML or a similar markup language) from document presentation, including elements such as the layout, colors, and fonts.[1] This separation can improve content accessibility, provide more flexibility and control in the specification of presentation characteristics, enable multiple pages to share formatting, and reduce complexity and repetition in the structural content (such as by allowing for tableless web design).          </p>        </div>      </div>                </div>    <div id="footer">        <p>Feel free to google more about the subject</p>      </div>     </body>  </html>  The markup is very easy to follow. I have used some HTML 5 tags and the relevant HTML 5 doctype.The CSS code (style.css) follows  body{        line-height: 30px;        width: 1024px;        background-color:#eee;      }            p{        font-size:17px;    font-family:"Comic Sans MS"      }      p,h2,h3,h4{        margin: 0 0 20px 0;      }            #main, #header, #footer{        width: 100%;        margin: 0px auto;        display:block;      }            #header{        text-align: center;         border-bottom: 1px solid #000;         margin-bottom: 30px;      }            #footer{        text-align: center;         border-top: 1px solid #000;         margin-bottom: 30px;      }            .quote{        width: 200px;       margin-left: 10px;       padding: 5px;       float: right;       border: 2px solid #000;       background-color:#F9ACAE;      }            .quote :last-child{        margin-bottom: 0;      }            #main{        column-count:2;        column-gap:20px;        column-rule: 1px solid #000;        -moz-column-count: 2;        -webkit-column-count: 2;        -moz-column-gap: 20px;        -webkit-column-gap: 20px;        -moz-column-rule: 1px solid #000;        -webkit-column-rule: 1px solid #000;      }       All the rules in the css code are pretty simple. The layout is achieved with that CSS rule #main{        column-count:2;        column-gap:20px;        column-rule: 1px solid #000;        -moz-column-count: 2;        -webkit-column-count: 2;        -moz-column-gap: 20px;        -webkit-column-gap: 20px;        -moz-column-rule: 1px solid #000;        -webkit-column-rule: 1px solid #000; Do note the column-count,column-gap and column-rule properties. These properties make the two column layout possible.Please have a look at the picture below to see why I used prefixes for Chrome (webkit) and Firefox(moz).It clearly indicates that the CSS 3 column layout are not supported from Firefox and Chrome.   Finally I test my simple HTML 5 page using the latest versions of Firefox,Internet Explorer and Chrome. In my machine I have installed Firefox 15.0.1.Have a look at the picture below to see how the page looks  I have installed Google Chrome 21.0 in my machine.Have a look at the picture below to see how the page looks Have a look at the picture below to see how my page looks in IE 10.  My page looks the same in all browsers. Hope it helps!!!

    Read the article

  • Using CSS3 media queries in HTML 5 pages

    - by nikolaosk
    This is going to be the seventh post in a series of posts regarding HTML 5. You can find the other posts here , here , here, here , here and here. In this post I will provide a hands-on example on how to use CSS 3 Media Queries in HTML 5 pages. This is a very important feature since nowadays lots of users view websites through their mobile devices. Web designers were able to define media-specific style sheets for quite a while, but have been limited to the type of output. The output could only be Screen, Print .The way we used to do things before CSS 3 was to have separate CSS files and the browser decided which style sheet to use. Please have a look at the snippet below - HTML 4 media queries <link rel="stylesheet" type="text/css" media="screen" href="styles.css"> <link rel="stylesheet" type="text/css" media="print" href="print-styles.css"> ?he browser determines which style to use. With CSS 3 we can have all media queries in one stylesheet. Media queries can determine the resolution of the device, the orientation of the device, the width and height of the device and the width and height of the browser window.We can also include CSS 3 media queries in separate stylesheets. In order to be absolutely clear this is not (and could not be) a detailed tutorial on HTML 5. There are other great resources for that.Navigate to the excellent interactive tutorials of W3School. Another excellent resource is HTML 5 Doctor. Two very nice sites that show you what features and specifications are implemented by various browsers and their versions are http://caniuse.com/ and http://html5test.com/. At this times Chrome seems to support most of HTML 5 specifications.Another excellent way to find out if the browser supports HTML 5 and CSS 3 features is to use the Javascript lightweight library Modernizr. In this hands-on example I will be using Expression Web 4.0.This application is not a free application. You can use any HTML editor you like.You can use Visual Studio 2012 Express edition. You can download it here. Before I go on with the actual demo I will use the (http://www.caniuse.com) to see the support for CSS 3 Media Queries from the latest versions of modern browsers. Please have a look at the picture below. We see that all the latest versions of modern browsers support this feature. We can see that even IE 9 supports this feature.   Let's move on with the actual demo.  This is going to be a rather simple demo.I create a simple HTML 5 page. The markup follows and it is very easy to use and understand.This is a page with a 2 column layout. <!DOCTYPE html><html lang="en">  <head>    <title>HTML 5, CSS3 and JQuery</title>    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >    <link rel="stylesheet" type="text/css" href="style.css">       </head>  <body>    <div id="header">      <h1>Learn cutting edge technologies</h1>      <p>HTML 5, JQuery, CSS3</p>    </div>    <div id="main">      <div id="mainnews">        <div>          <h2>HTML 5</h2>        </div>        <div>          <p>            HTML5 is the latest version of HTML and XHTML. The HTML standard defines a single language that can be written in HTML and XML. It attempts to solve issues found in previous iterations of HTML and addresses the needs of Web Applications, an area previously not adequately covered by HTML.          </p>          <div class="quote">            <h4>Do More with Less</h4>            <p>             jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development.             </p>            </div>          <p>            The HTML5 test(html5test.com) score is an indication of how well your browser supports the upcoming HTML5 standard and related specifications. Even though the specification isn't finalized yet, all major browser manufacturers are making sure their browser is ready for the future. Find out which parts of HTML5 are already supported by your browser today and compare the results with other browsers.                      The HTML5 test does not try to test all of the new features offered by HTML5, nor does it try to test the functionality of each feature it does detect. Despite these shortcomings we hope that by quantifying the level of support users and web developers will get an idea of how hard the browser manufacturers work on improving their browsers and the web as a development platform.</p>        </div>      </div>              <div id="CSS">        <div>          <h2>CSS 3 Intro</h2>        </div>        <div>          <p>          Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation semantics (the look and formatting) of a document written in a markup language. Its most common application is to style web pages written in HTML and XHTML, but the language can also be applied to any kind of XML document, including plain XML, SVG and XUL.          </p>        </div>      </div>            <div id="CSSmore">        <div>          <h2>CSS 3 Purpose</h2>        </div>        <div>          <p>            CSS is designed primarily to enable the separation of document content (written in HTML or a similar markup language) from document presentation, including elements such as the layout, colors, and fonts.[1] This separation can improve content accessibility, provide more flexibility and control in the specification of presentation characteristics, enable multiple pages to share formatting, and reduce complexity and repetition in the structural content (such as by allowing for tableless web design).          </p>        </div>      </div>                </div>    <div id="footer">        <p>Feel free to google more about the subject</p>      </div>     </body>  </html>    The CSS code (style.css) follows  body{        line-height: 30px;        width: 1024px;        background-color:#eee;      }            p{        font-size:17px;    font-family:"Comic Sans MS"      }      p,h2,h3,h4{        margin: 0 0 20px 0;      }            #main, #header, #footer{        width: 100%;        margin: 0px auto;        display:block;      }            #header{        text-align: center;         border-bottom: 1px solid #000;         margin-bottom: 30px;      }            #footer{        text-align: center;         border-top: 1px solid #000;         margin-bottom: 30px;      }            .quote{        width: 200px;       margin-left: 10px;       padding: 5px;       float: right;       border: 2px solid #000;       background-color:#F9ACAE;      }            .quote :last-child{        margin-bottom: 0;      }            #main{        column-count:2;        column-gap:20px;        column-rule: 1px solid #000;        -moz-column-count: 2;        -webkit-column-count: 2;        -moz-column-gap: 20px;        -webkit-column-gap: 20px;        -moz-column-rule: 1px solid #000;        -webkit-column-rule: 1px solid #000;      } Now I view the page in the browser.Now I am going to write a media query and add some more rules in the .css file in order to change the layout of the page when the page is viewed by mobile devices. @media only screen and (max-width: 480px) {          body{            width: 480px;          }          #main{            -moz-column-count: 1;            -webkit-column-count: 1;          }        }   I am specifying that this media query applies only to screen and a max width of 480 px. If this condition is true, then I add new rules for the body element. I change the number of columns to one. This rule will not be applied unless the maximum width is 480px or less.  As I decrease the size-width of the browser window I see no change in the column's layout. Have a look at the picture below. When I resize the window and the width of the browser so the width is less than 480px, the media query and its respective rules take effect.We can scroll vertically to view the content which is a more optimised viewing experience for mobile devices. Have a look at the picture below Hope it helps!!!!

    Read the article

  • Web optimization

    - by hmloo
    1. CSS Optimization Organize your CSS code Good CSS organization helps with future maintainability of the site, it helps you and your team member understand the CSS more quickly and jump to specific styles. Structure CSS code For small project, you can break your CSS code in separate blocks according to the structure of the page or page content. for example you can break your CSS document according the content of your web page(e.g. Header, Main Content, Footer) Structure CSS file For large project, you may feel having too much CSS code in one place, so it's the best to structure your CSS into more CSS files, and use a master style sheet to import these style sheets. this solution can not only organize style structure, but also reduce server request./*--------------Master style sheet--------------*/ @import "Reset.css"; @import "Structure.css"; @import "Typography.css"; @import "Forms.css"; Create index for your CSS Another important thing is to create index at the beginning of your CSS file, index can help you quickly understand the whole CSS structure./*---------------------------------------- 1. Header 2. Navigation 3. Main Content 4. Sidebar 5. Footer ------------------------------------------*/ Writing efficient CSS selectors keep in mind that browsers match CSS selectors from right to left and the order of efficiency for selectors 1. id (#myid) 2. class (.myclass) 3. tag (div, h1, p) 4. adjacent sibling (h1 + p) 5. child (ul > li) 6. descendent (li a) 7. universal (*) 8. attribute (a[rel="external"]) 9. pseudo-class and pseudo element (a:hover, li:first) the rightmost selector is called "key selector", so when you write your CSS code, you should choose more efficient key selector. Here are some best practice: Don't tag-qualify Never do this:div#myid div.myclass .myclass#myid IDs are unique, classes are more unique than a tag so they don't need a tag. Doing so makes the selector less efficient. Avoid overqualifying selectors for example#nav a is more efficient thanul#nav li a Don't repeat declarationExample: body {font-size:12px;}h1 {font-size:12px;font-weight:bold;} since h1 is already inherited from body, so you don't need to repeate atrribute. Using 0 instead of 0px Always using #selector { margin: 0; } There’s no need to include the px after 0, removing all those superfluous px can reduce the size of your CSS file. Group declaration Example: h1 { font-size: 16pt; } h1 { color: #fff; } h1 { font-family: Arial, sans-serif; } it’s much better to combine them:h1 { font-size: 16pt; color: #fff; font-family: Arial, sans-serif; } Group selectorsExample: h1 { color: #fff; font-family: Arial, sans-serif; } h2 { color: #fff; font-family: Arial, sans-serif; } it would be much better if setup as:h1, h2 { color: #fff; font-family: Arial, sans-serif; } Group attributeExample: h1 { color: #fff; font-family: Arial, sans-serif; } h2 { color: #fff; font-family: Arial, sans-serif; font-size: 16pt; } you can set different rules for specific elements after setting a rule for a grouph1, h2 { color: #fff; font-family: Arial, sans-serif; } h2 { font-size: 16pt; } Using Shorthand PropertiesExample: #selector { margin-top: 8px; margin-right: 4px; margin-bottom: 8px; margin-left: 4px; }Better: #selector { margin: 8px 4px 8px 4px; }Best: #selector { margin: 8px 4px; } a good diagram illustrated how shorthand declarations are interpreted depending on how many values are specified for margin and padding property. instead of using:#selector { background-image: url(”logo.png”); background-position: top left; background-repeat: no-repeat; } is used:#selector { background: url(logo.png) no-repeat top left; } 2. Image Optimization Image Optimizer Image Optimizer is a free Visual Studio2010 extension that optimizes PNG, GIF and JPG file sizes without quality loss. It uses SmushIt and PunyPNG for the optimization. Just right click on any folder or images in Solution Explorer and choose optimize images, then it will automatically optimize all PNG, GIF and JPEG files in that folder. CSS Image Sprites CSS Image Sprites are a way to combine a collection of images to a single image, then use CSS background-position property to shift the visible area to show the required image, many images can take a long time to load and generates multiple server requests, so Image Sprite can reduce the number of server requests and improve site performance. You can use many online tools to generate your image sprite and CSS, and you can also try the Sprite and Image Optimization framework released by The ASP.NET team.

    Read the article

  • Setting marker title in Google Maps API 3 using jQuery

    - by bateman_ap
    Hi, I am having a couple of problems with Google Maps and jQuery. Wondered if anyone can help with the smaller of the two problems and hopefully it will help me to fixing the bigger one. I am using the below code to populate a google map, basically it uses generated HTML to populate the maps in the form: <div class="item mapSearch" id="map52.48228_-1.9026:800"> <div class="box-prise"><p>(0.62km away)</p><div class="btn-book-now"> <a href="/venue/800.htm">BOOK NOW</a> </div> </div><img src="http://media.toptable.com/images/thumb/13152.jpg" alt="Metro Bar and Grill" width="60" height="60" /> <div class="info"> <h2><a href="/venue/800.htm">Metro Bar and Grill</a></h2> <p class="address">73 Cornwall Street, Birmingham, B3 2DF</p><strong class="proposal">2 courses £14.50</strong> <dl> <dt>Diner Rating: </dt> <dd>7.8</dd> </dl></div></div> <div class="item mapSearch" id="map52.4754_-1.8999:3195"> <div class="box-prise"><p>(0.97km away)</p><div class="btn-book-now"> <a href="/venue/3195.htm">BOOK NOW</a> </div> </div><img src="http://media.toptable.com/images/thumb/34998.jpg" alt="Filini Restaurant - Birmingham" width="60" height="60" /> <div class="info"> <h2><a href="/venue/3195.htm">Filini Restaurant - Birmingham</a></h2> <p class="address">Radisson Blu Hotel, 12 Holloway Circus, Queensway, Birmingham, B1 1BT</p><strong class="proposal">2 for 1: main courses </strong> <dl> <dt>Diner Rating: </dt> <dd>7.8</dd> </dl></div></div> <div class="item mapSearch" id="map52.47775_-1.90619:10657"> <div class="box-prise"><p>(1.05km away)</p><div class="btn-book-now"> <a href="/venue/10657.htm">BOOK NOW</a> </div> </div><img src="http://media.toptable.com/images/thumb/34963.jpg" alt="B1 " width="60" height="60" /> <div class="info"> <h2><a href="/venue/10657.htm">B1 </a></h2> <p class="address">Central Square , Birmingham, B1 1HH</p><strong class="proposal">25% off food</strong> <dl> <dt>Diner Rating: </dt> <dd>7.9</dd> </dl></div></div> The JavaScript loops though all the divs with class mapSearch and uses this to plot markers using the div ID to get the lat/lon and ID of the venue: var locations = $(".mapSearch"); for (var i=0;i<locations.length;i++) { var id = locations[i].id; if (id) { var jsLonLat = id.substring(3).split(":")[0]; var jsId = id.substring(3).split(":")[1]; var jsLat = jsLonLat.split("_")[0]; var jsLon = jsLonLat.split("_")[1]; var jsName = $("h2").text(); var jsAddress = $("p.address").text(); var latlng = new google.maps.LatLng(jsLat,jsLon); var marker = new google.maps.Marker({ position: latlng, map:map, icon: greenRestaurantImage, title: jsName }); google.maps.event.addListener(marker, 'click', function() { //Check to see if info window already exists if (!infowindow) { //if doesn't exist then create a empty InfoWindow object infowindow = new google.maps.InfoWindow(); } //Set the content of InfoWindow infowindow.setContent(jsAddress); //Tie the InfoWindow to the market infowindow.open(map,marker); }); bounds.extend(latlng); map.fitBounds(bounds); } } The markers all plot OK on the map, however I am having probs with the infoWindow bit. I want to display info about each venue when clicked, however using my code above it just puts all info in one box when clicked, not individually. Hoping it is a simple fix! Hoping once I fix this I can work out a way to get the info window displaying if I hover over the div in the html.

    Read the article

  • Running in to some issues with Tumblr's Theme Parser

    - by Kylee
    Below part of a tumblr theme I'm working on and you will notice that I use the {block:PostType} syntax to declare the opening tag of each post, which is a <li> element in an Ordered List. This allows me to not only dynamicly set the li's class based on the type of post but cuts down on the number of times I'm calling the ShareThis JS which was really bogging down the page. This creates a new issue though which I believe is a flaw in Tumblr's parser. Each post is an ordered list with one <li> element in it. I know I could solve this by having each post as a <div> but I really like the control and semantics of using a list. Tumblr gurus? Suggestions? Sample of code: {block:Posts} <ol class="posts"> {block:Text} <li class="post type_text" id="{PostID}"> {block:Title} <h2><a href="{Permalink}" title="Go to post '{Title}'.">{Title}</a></h2> {/block:Title} {Body} {/block:Text} {block:Photo} <li class="post type_photo" id="{PostID}"> <div class="image"> <a href="{LinkURL}"><img src="{PhotoURL-500}" alt="{PhotoAlt}"></a> </div> {block:Caption} {Caption} {/block:Caption} {/block:Photo} {block:Photoset} <li class="post type_photoset" id="{PostID}"> {Photoset-500} {block:Caption} {Caption} {/block:Caption} {/block:Photoset} {block:Quote} <li class="post type_quote" id="{PostID}"> <blockquote> <div class="quote_symbol">&ldquo;</div> {Quote} </blockquote> {block:Source} <div class="quote_source">{Source}</div> {/block:Source} {/block:Quote} {block:Link} <li class="post type_link" id="{PostID}"> <h2><a href="{URL}" {Target} title="Go to {Name}.">{Name}</a></h2> {block:Description} {Description} {/block:Description} {/block:Link} {block:Chat} <li class="post type_chat" id="{PostID}"> {block:Title} <h2><a href="{Permalink}" title="Go to post {PostID} '{Title}'.">{Title}</a></h2> {/block:Title} <table class="chat_log"> {block:Lines} <tr class="{Alt} user_{UserNumber}"> <td class="person">{block:Label}{Label}{/block:Label}</td> <td class="message">{Line}</td> </tr> {/block:Lines} </table> {/block:Chat} {block:Video} <li class="post type_video" id="{PostID}"> {Video-500} {block:Caption} {Caption} {/block:Caption} {/block:Video} {block:Audio} <li class="post type_audio" id="{PostID}"> {AudioPlayerWhite} {block:Caption} {Caption} {/block:Caption} {block:ExternalAudio} <p><a href="{ExternalAudioURL}" title="Download '{ExternalAudioURL}'">Download</a></p> {/block:ExternalAudio} {/block:Audio} <div class="post_footer"> <p class="post_date">Posted on {ShortMonth} {DayOfMonth}, {Year} at {12hour}:{Minutes} {AmPm}</p> <ul> <li><a class="comment_link" href="{Permalink}#disqus_thread">Comments</a></li> <li><script type="text/javascript" src="http://w.sharethis.com/button/sharethis.js#publisher=722e181d-1d8a-4363-9ebe-82d5263aea94&amp;type=website"></script></li> </ul> {block:PermalinkPage} <div id="disqus_thread"></div> <script type="text/javascript" src="http://disqus.com/forums/kyleetilley/embed.js"></script> <noscript><a href="http://disqus.com/forums/kyleetilley/?url=ref">View the discussion thread.</a></noscript> {/block:PermalinkPage} </div> </li> </ol> {/block:Posts}

    Read the article

  • css sticky footer without scrolbar

    - by massinissa
    How to do to avoid having the scroller with a sticky footer to the bottom of the page (not bottom of window)? When I remove height=100% from content and sidebar, I'm no more getting the scroller. However, when doing so, my content and sidebar do not fill all the space down to the footer. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Untitled 13</title> <style media="all" type="text/css"> * { margin: 0; padding: 0; } html, body, #wrap, form { height: 100%; } #wrap, #footer { width: 750px; margin: 0 auto; } #wrap { background: #cff; } html, body { color: #000; background: #a7a09a; } body > #wrap { height: 100%; min-height: 100%; } form { /*height: auto;*/ min-height: 100%; } #main { background: #000; height:100%; min-height:100%; height: auto !important; */ } #content { height:100%; float: left; padding: 10px; float: left; width: 570px; background: #9c9; } #sidebar { height:100%; float: left; width: 140px; background: #c99; padding: 10px; } #footer { position: relative; margin-top: -100px; height: 100px; clear: both; background: #cc9; bottom: 0; } .clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } .clearfix { display: inline-block; } * html .clearfix { height: 1%; } .clearfix { display: block; } #header { /*padding: 5px 10px;*/ background: #ddd; } </style> </head> <body> <form id="form1" runat="server"> <div id="wrap"> <div id="main" class="clearfix"> <div id="header"> <h1>header</h1> </div> <div id="sidebar"> <h2>sidebar</h2> </div> <div id="content"> <h2>main content</h2> </div> </div> </div> <div id="footer"> <h2>footer</h2> </div> </form> </body> </html>

    Read the article

  • Am I suffering "divitis"? (CSS especialist needed)

    - by janoChen
    I've read lots of articles that condemn the excessive use of divs. I have a feeling that I might be doing that in the following mark up: HTML: <div id="header"> <div class="container"> <div id="banner"> <h1><a href="http://widerdesign.co.nr/">wider design</a></h1> <ul id="lang"> <li><a href="index.php">English</a></li> <li><a href="es/index.php">Español</a></li> <li><a href="tw/index.php">??(??)</a></li> <li><a href="cn/index.php">??(??)</a></li> </ul> </div> <div id="intro"> <div id="tagline"> <h2>Nulla vitae tortor mauris</h2> <p>Pellentesque faucibus est eu tellus varius in susc...</p> </div> <div id="about"> <h2>right</h2> <p>Pellentesque faucibus est eu tellus varius in susc...</p> </div> </div><!-- #intro --> </div><!-- .container --> </div><!-- #header --> CSS: .container { margin: 0 auto; overflow: hidden; width: 960px; } /* header */ #header { background: #EEE; } #header h1 { float: left; } #header h2, #header a, #header p { color: #999; } #header h1 a { background: url(../images/logo.png) no-repeat scroll 0 0; float: left; height: 30px; text-indent: -9999px; width: 500px; } #banner { border-bottom: 1px solid #DDD; padding: 0 0 15px 0; margin: 30px 0 30px 0; overflow: hidden; width: 960px; } #lang { float: right; padding: 9px 0 0 0; } #lang li { float: left; margin: 0 0 0 20px; } #lang li a { font-size: 10px; } /* intro */ #intro { overflow: hidden; padding: 0 0 30px 0; } #tagline { float: left; margin: 0 40px 0 0; width: 540px; /* 560 */ } #tagline h2 { font-size: 24px; } #about { float: right; width: 380px; } Explanation of the use of those divs: header: Defines the background color which expands until the end of the window (lies outside of the div .container). container: centers the content (but not the background). banner: to define the background or border color around ul#lang and h1. intro: same as above but for #tagline and #about (otherwise I have to define say padding or margin for tagline and about individually). Am I overusing divs? Can this be simplified?

    Read the article

  • Whatever hover not working IE6 and IE7

    - by jovialwhispers
    Below is the css for my menu #menu { position: absolute; left: 170px; top: 92px; background: #336699; float: left; z-index:50; } menu ul { list-style: none; margin: 0; padding: 0; width: 9em; float: left; } menu a, #menu h2 { font: bold 11px/20px arial, helvetica, sans-serif; display: block; border-top-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-width: 1px; border-style: solid; border-color: #ccc #888 #555 #bbb; margin: 0; padding: 4px 3px; } menu h2 { color: #fff; background: #336699; text-transform: uppercase; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 1px; border-right-width: 1px; } menu a { color: #fff; background: #79A3CF; text-decoration: none; } menu a:hover { color: #a00; background: #fff; } menu li { position: relative; } menu li ul li { position: relative; width: 12em; } menu ul ul { position: absolute; z-index: 500; } menu ul ul ul { position: absolute; top: 0; left: 100%; } div#menu ul ul, div#menu ul li:hover ul ul, div#menu ul ul li:hover ul ul { display: none; } div#menu ul li:hover ul, div#menu ul ul li:hover ul, div#menu ul ul ul li:hover ul { display: block; } Here is my html design for the menu. It is a horizontal menu with dropdown submenus <div id="menu"> <ul> <li><h2>Computers</h2> <ul> <li>subitem <ul><li>subitems</li> </li> <li>submitem</li> <li>submitem</li> </li> <li><h2>Network</h2> <ul><li>subitems</li> </li> </ul> </div> I am using the minified version of the whatever hover script. Checked few posts here on this issue but couldn't solve the problem. The submenus are not appearing on IE6 and IE7. I trid adding <!--[if lt IE 8]> but no results...

    Read the article

  • DirectX Unproject troubles

    - by pivotnig
    I have an orthographic projection and I try to unproject a point from screen space. Following are the view and projection matrices: var w2 = ScreenWidthInPixels/2; var h2 = ScreenHeightInPixels/2; view = Matrix.LookAtLH(new Vector3(0, 0, -1), new Vector3(0, 0, 0), Vector3.UnitY); proj = Matrix.OrthoOffCenterLH(-w2, w2, -h2, h2, 0.1f, 10f); Here is how I unproject a Point p, the point is given in screen pixels: var m = Vector3.Unproject(p, 0, 0, ScreenWidthInPixels, ScreenHeightInPixels, 0.1f, 10f, // znear and zfar view *proj); My code doesn't work, the matrix m contains only Nan. When I try to invert view * proj I get back a Matrix with only zeros. So I suspect my problem has something to do with the orthographic projection matrix. Here are my questions: Could the problem be caused by an underflow due to the large values in the OrthoOffCenterLH projection? What parameters do I have to pass for x,y,width,height in Unproject(...)? What significance has the minZ and maxZ parameter in Unproject(...)? Does it matter what I pass for p.Z in Unproject(...)?

    Read the article

  • Repurposing CSS Class Selectors

    - by limefartlek
    I don't know what this technique is called, I've only seen it used. It's a way to repurpose the same selectors with CSS. For example if I create h1 { font-size:18px; color:#FFFFFF; font-family:Arial, Helvetica;margin:0; padding:0; } h2 { font-size:18px; color:#000000; font-family:Arial, Helvetica; font-weight:normal;margin:0; padding:0; } I can repurpose the h selectors with something like .whatever h1 { color: #000; font: 2.0em arial, sans-serif; background-color: #fff3ea; margin: 50px 0px 0px 50px; } .whatever h2 { color: #000; font: 1.7em bold arial, sans-serif; background-color: #fff3ea; margin: 25px 0px 25px 75px; } If h1 and h2 appear inside of a div called whatever, then they will assume those properties. You can do this with ID tags and class tags but I can't for the life of me remember how this is done. Any thoughts?

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >