CSS Display and Visibility

download CSS Display and Visibility

of 2

Transcript of CSS Display and Visibility

  • 8/12/2019 CSS Display and Visibility

    1/2

    8/4/13 CSS Display and Visibility

    w3schools.com/css/css_display_visibility.asp 1/2

    HOME HTML CSS JAVASCRIPT JQUERY XML ASP.NET PHP SQL MORE... REFERENCES | EXAMPLES | FORUM | ABOU

    Get CertifiedSt udy Web Tech nologies

    and get a dip lomaat w3schools .com

    SHARE THIS PAGE

    Like 76k

    CS S BasicCSS HOME

    CS S Introduction

    CS S Syntax

    CSS Id & Class

    CS S How To

    CS S StylingSty ling Backgrou nds

    Sty ling Text

    Sty ling Fonts

    Sty ling Links

    Styling Lists

    Sty ling Tables

    CS S Box Mode lCSS Box Model

    CS S Border

    CS S Outline

    CS S Margin

    CSS Padding

    CS S AdvancedCS S Grouping/Ne sting

    CSS Dimens ion

    CSS Display

    CSS Pos itioning

    CS S Floating

    CS S Align

    CSS Pseudo-class

    CSS Pseudo -elementCSS Navigation Bar

    CSS Image Gallery

    CSS Image Opacity

    CSS Image Sprites

    CSS Media Types

    CSS Attribute Selectors

    CSS Summary

    CSS ExamplesCSS Examples

    CSS Quiz

    CSS Certificate

    CSS ReferencesCSS Reference

    CSS Selectors

    CSS Reference Aural

    CSS Web Safe Fonts

    CSS Units

    CSS Colors

    CSS Color Values

    CSS Color Names

    CSS Color HEX

    Previous Next Chapter

    Box 1

    Remove

    Box 2

    Hide

    Box 3

    Reset All

    CSS Display and Visibilit y

    The display property specifies if/how an ele ment is dis played, and the visibility property specifies if anelement should be visible or hidden.

    Hiding an Element - display :none or visibility:hiddenHiding an e lement can be done by s etting the display property to "none " or the visibility property to "hidden".However, notice that these two methods produc e different r esults:

    visibility:hidden hides an element, but it will still take up the same space a s before. The element will be hidden,but still affect the layout.

    Example

    h1.hidden {visibility:hidden;}

    Try it yourself

    d isplay:none hides an element, and it will not take up any s pace. The element will be hidden, and the p age w ill bed isplayed as if the element is not the re:

    Example

    h1.hidden {display:none;}

    Try it yourself

    CSS Display - Block and Inline ElementsA block element is an element that takes up the full width available, and has a line break before a nd after it.

    Examples of block elements:

    An inline element only takes up as much width as necessary, and doe s not force line breaks.

    Examples of inline elements:

    Changing How an Element is DisplayedChanging an inline element to a block element, or vice versa, can be useful for making the page look a spe cificway, and still follow web s tandards.

    The following example displays list items as inline elements:

    Example

    li {display:inline;}

    Try it yourself

    The following e xample displays sp an elements a s block elements:

    Example

    span {display:block;}

    WEB HOSTING

    Best Web Hosting

    eUK Web Hosting

    UK Reseller Hosting

    Domain, Hosting & Emai

    WEB BUILDING

    Download XML Editor

    FREE Website BUILDER

    FREE Website C reator

    Best Website Templates

    STATISTICS

    Browser Statistics

    OS Statistics

    Display Statistics

    Search w3schools.com:

    Select Language

    http://w3schools.com/cssref/css_colorsfull.asphttp://w3schools.com/cssref/css_colors_legal.asphttp://w3schools.com/cssref/css_colors.asphttp://w3schools.com/cssref/css_selectors.asphttp://w3schools.com/cssref/css_selectors.asphttp://w3schools.com/css/css_exam.asphttp://w3schools.com/css/css_examples.asphttp://w3schools.com/css/css_attribute_selectors.asphttp://w3schools.com/css/css_image_gallery.asphttp://w3schools.com/css/css_image_gallery.asphttp://w3schools.com/css/css_pseudo_elements.asphttp://w3schools.com/css/css_align.asphttp://w3schools.com/css/css_positioning.asphttp://w3schools.com/css/css_dimension.asphttp://w3schools.com/css/css_padding.asphttp://w3schools.com/css/css_border.asphttp://w3schools.com/css/css_border.asphttp://w3schools.com/css/css_list.asphttp://w3schools.com/css/css_font.asphttp://w3schools.com/css/css_background.asphttp://w3schools.com/css/css_syntax.asphttp://w3schools.com/css/css_syntax.asphttp://w3schools.com/css/default.asphttp://adclick.g.doubleclick.net/aclk?sa=L&ai=BbCvT9hT-UZSxLYa_igeszoGwD4_fz4gDAAAAEAEg5-j6ATgAWK-p9o1IYOXC5IOkDrIBDXczc2Nob29scy5jb226AQlnZnBfaW1hZ2XIAQnaATNodHRwOi8vdzNzY2hvb2xzLmNvbS9jc3MvY3NzX2Rpc3BsYXlfdmlzaWJpbGl0eS5hc3CpAugYxmWcmoY-wAIC4AIA6gIaLzE2ODMzMTc1L1RvcExlZnRSZWN0YW5nbGX4AoHSHpADmgiYA8gGqAMB0ASQTuAEAaAGFg&num=0&sig=AOD64_22GK8zxwlPYXspgpRoRrs-uh5TOA&client=ca-pub-3440800076797949&adurl=http://w3schools.com/cert/default.asphttp://www.w3schools.com/http://www.w3schools.com/http://www.googleadservices.com/pagead/aclk?sa=L&ai=C_ye99hT-UYb-LYXEigeXlYGACe6Kg9oFls6Vrnj5_d54EAEg5-j6AVC3wLCN-f____8BYOXC5IOkDqABivP0yQPIAQLgAgCoAwHIA50EqgSuAU_QiBgSrxmklL2-vmNans0jlmt790QOSWd423ckyysbs0PtBpmsuWRSQHnTINKRTwniSh5C1POMDk28REBgNnEdMpov3fODp0Pr9xiNaGekI_7uPo00jjTHio-zuJOjIZZ7mMMwxtgFJx3osxssofJcJJbm0tzOgGg8ZL8udziVZud3DlhZ_Ydu1OVm3-RQwnfR7cVcR5mNAJIE4kmzUZsVDl1utExyV6ig-syiiOAEAYgGAaAGAoAH3oyLNg&num=1&cid=5GiUM0_pzbXe0Z7XQlwzBUpt&sig=AOD64_2K2JWYmWAPjo_7x2fIbLFrY1sZBQ&client=ca-pub-3440800076797949&adurl=http://neo4j.org/learn&nm=1http://www.googleadservices.com/pagead/aclk?sa=L&ai=C_ye99hT-UYb-LYXEigeXlYGACe6Kg9oFls6Vrnj5_d54EAEg5-j6AVC3wLCN-f____8BYOXC5IOkDqABivP0yQPIAQLgAgCoAwHIA50EqgSuAU_QiBgSrxmklL2-vmNans0jlmt790QOSWd423ckyysbs0PtBpmsuWRSQHnTINKRTwniSh5C1POMDk28REBgNnEdMpov3fODp0Pr9xiNaGekI_7uPo00jjTHio-zuJOjIZZ7mMMwxtgFJx3osxssofJcJJbm0tzOgGg8ZL8udziVZud3DlhZ_Ydu1OVm3-RQwnfR7cVcR5mNAJIE4kmzUZsVDl1utExyV6ig-syiiOAEAYgGAaAGAoAH3oyLNg&num=1&cid=5GiUM0_pzbXe0Z7XQlwzBUpt&sig=AOD64_2K2JWYmWAPjo_7x2fIbLFrY1sZBQ&client=ca-pub-3440800076797949&adurl=http://neo4j.org/learn&nm=1http://www.googleadservices.com/pagead/aclk?sa=L&ai=C_ye99hT-UYb-LYXEigeXlYGACe6Kg9oFls6Vrnj5_d54EAEg5-j6AVC3wLCN-f____8BYOXC5IOkDqABivP0yQPIAQLgAgCoAwHIA50EqgSuAU_QiBgSrxmklL2-vmNans0jlmt790QOSWd423ckyysbs0PtBpmsuWRSQHnTINKRTwniSh5C1POMDk28REBgNnEdMpov3fODp0Pr9xiNaGekI_7uPo00jjTHio-zuJOjIZZ7mMMwxtgFJx3osxssofJcJJbm0tzOgGg8ZL8udziVZud3DlhZ_Ydu1OVm3-RQwnfR7cVcR5mNAJIE4kmzUZsVDl1utExyV6ig-syiiOAEAYgGAaAGAoAH3oyLNg&num=1&cid=5GiUM0_pzbXe0Z7XQlwzBUpt&sig=AOD64_2K2JWYmWAPjo_7x2fIbLFrY1sZBQ&client=ca-pub-3440800076797949&adurl=http://neo4j.org/learn&nm=1http://www.googleadservices.com/pagead/aclk?sa=L&ai=C_ye99hT-UYb-LYXEigeXlYGACe6Kg9oFls6Vrnj5_d54EAEg5-j6AVC3wLCN-f____8BYOXC5IOkDqABivP0yQPIAQLgAgCoAwHIA50EqgSuAU_QiBgSrxmklL2-vmNans0jlmt790QOSWd423ckyysbs0PtBpmsuWRSQHnTINKRTwniSh5C1POMDk28REBgNnEdMpov3fODp0Pr9xiNaGekI_7uPo00jjTHio-zuJOjIZZ7mMMwxtgFJx3osxssofJcJJbm0tzOgGg8ZL8udziVZud3DlhZ_Ydu1OVm3-RQwnfR7cVcR5mNAJIE4kmzUZsVDl1utExyV6ig-syiiOAEAYgGAaAGAoAH3oyLNg&num=1&cid=5GiUM0_pzbXe0Z7XQlwzBUpt&sig=AOD64_2K2JWYmWAPjo_7x2fIbLFrY1sZBQ&client=ca-pub-3440800076797949&adurl=http://neo4j.org/learn&nm=1http://w3schools.com/browsers/browsers_stats.asphttp://www.wix.com/eteamhtml/400?utm_campaign=ma_w3schools.com&experiment_id=ma_w3schools.comlink2_400http://www.altova.com/ref/?s=w3s_text&q=xmlspyhttp://www.googleadservices.com/pagead/aclk?sa=L&ai=Cm1KA9hT-Ucn8LYK6igeku4DIAbDuuskB6NbgkRbAjbcBEAEg5-j6AVDi2PlvYOXC5IOkDqAB-MHy-gPIAQLgAgCoAwHIA50EqgSrAU_Qb6E81YODG3NdKmGfq4GGrwCk37D8KTH_tGd6seYqY10B3QALPVGRSvOUVeH23a6AjJhDMH7BI2gcIMArqDjwhiyNiIGSUTHdorBk5L0H2VNJ9zVbaKdpC55sJnir-C4Az_cALroC4Qrlmln2mwjlvAQQLNgz4LSh3F6GlyR43eYfdka4_wbW5wG-YELI9lLl-GQRA0vE_rzeZop2Fk2C1AkRXvwaUUYH4-AEAYgGAaAGAoAH8L2NBQ&num=1&cid=5Ghz_xJWsORazHCLNoMJUZF9&sig=AOD64_3fWjbQryW9QINUa6sGcKct2pOjmA&client=ca-pub-3440800076797949&adurl=http://www.smartclient.com/smartgwt/index.jsp&nm=3http://www.w3schools.com/http://www.w3schools.com/http://www.googleadservices.com/pagead/aclk?sa=L&ai=C_ye99hT-UYb-LYXEigeXlYGACe6Kg9oFls6Vrnj5_d54EAEg5-j6AVC3wLCN-f____8BYOXC5IOkDqABivP0yQPIAQLgAgCoAwHIA50EqgSuAU_QiBgSrxmklL2-vmNans0jlmt790QOSWd423ckyysbs0PtBpmsuWRSQHnTINKRTwniSh5C1POMDk28REBgNnEdMpov3fODp0Pr9xiNaGekI_7uPo00jjTHio-zuJOjIZZ7mMMwxtgFJx3osxssofJcJJbm0tzOgGg8ZL8udziVZud3DlhZ_Ydu1OVm3-RQwnfR7cVcR5mNAJIE4kmzUZsVDl1utExyV6ig-syiiOAEAYgGAaAGAoAH3oyLNg&num=1&cid=5GiUM0_pzbXe0Z7XQlwzBUpt&sig=AOD64_2K2JWYmWAPjo_7x2fIbLFrY1sZBQ&client=ca-pub-3440800076797949&adurl=http://neo4j.org/learn&nm=1http://www.googleadservices.com/pagead/aclk?sa=L&ai=Cm1KA9hT-Ucn8LYK6igeku4DIAbDuuskB6NbgkRbAjbcBEAEg5-j6AVDi2PlvYOXC5IOkDqAB-MHy-gPIAQLgAgCoAwHIA50EqgSrAU_Qb6E81YODG3NdKmGfq4GGrwCk37D8KTH_tGd6seYqY10B3QALPVGRSvOUVeH23a6AjJhDMH7BI2gcIMArqDjwhiyNiIGSUTHdorBk5L0H2VNJ9zVbaKdpC55sJnir-C4Az_cALroC4Qrlmln2mwjlvAQQLNgz4LSh3F6GlyR43eYfdka4_wbW5wG-YELI9lLl-GQRA0vE_rzeZop2Fk2C1AkRXvwaUUYH4-AEAYgGAaAGAoAH8L2NBQ&num=1&cid=5Ghz_xJWsORazHCLNoMJUZF9&sig=AOD64_3fWjbQryW9QINUa6sGcKct2pOjmA&client=ca-pub-3440800076797949&adurl=http://www.smartclient.com/smartgwt/index.jsp&nm=3http://void%280%29/http://w3schools.com/browsers/browsers_display.asphttp://w3schools.com/browsers/browsers_os.asphttp://w3schools.com/browsers/browsers_stats.asphttp://www.dreamtemplate.com/?ref=w3txtfreehttp://www.wix.com/eteamhtml/400?utm_campaign=ma_w3schools.com&experiment_id=ma_w3schools.comlink2_400http://www.wix.com/eteamhtml/400?utm_campaign=ma_w3schools.com&experiment_id=ma_w3schools.comlink1_400Html&embed_tags=camp&utm_camp=hOUdCO-AmAMQm__j8AMhttp://www.altova.com/ref/?s=w3s_text&q=xmlspyhttp://www.webhosting.uk.com/cpanel-hosting.phphttp://www.heartinternet.co.uk/http://www.eukhost.com/http://www.lunarpages.com/id/w3schools/goto/w3schoolshttp://w3schools.com/css/tryit.asp?filename=trycss_display_inline_listhttp://w3schools.com/css/tryit.asp?filename=trycss_display_nonehttp://w3schools.com/css/tryit.asp?filename=trycss_visibility_hiddenhttp://w3schools.com/css/css_positioning.asphttp://w3schools.com/css/css_dimension.asphttp://w3schools.com/cssref/css_colorsfull.asphttp://w3schools.com/cssref/css_colornames.asphttp://w3schools.com/cssref/css_colors_legal.asphttp://w3schools.com/cssref/css_colors.asphttp://w3schools.com/cssref/css_units.asphttp://w3schools.com/cssref/css_websafe_fonts.asphttp://w3schools.com/cssref/css_ref_aural.asphttp://w3schools.com/cssref/css_selectors.asphttp://w3schools.com/cssref/default.asphttp://w3schools.com/css/css_exam.asphttp://w3schools.com/css/css_quiz.asphttp://w3schools.com/css/css_examples.asphttp://w3schools.com/css/css_summary.asphttp://w3schools.com/css/css_attribute_selectors.asphttp://w3schools.com/css/css_mediatypes.asphttp://w3schools.com/css/css_image_sprites.asphttp://w3schools.com/css/css_image_transparency.asphttp://w3schools.com/css/css_image_gallery.asphttp://w3schools.com/css/css_navbar.asphttp://w3schools.com/css/css_pseudo_elements.asphttp://w3schools.com/css/css_pseudo_classes.asphttp://w3schools.com/css/css_align.asphttp://w3schools.com/css/css_float.asphttp://w3schools.com/css/css_positioning.asphttp://w3schools.com/css/css_display_visibility.asphttp://w3schools.com/css/css_dimension.asphttp://w3schools.com/css/css_grouping_nesting.asphttp://w3schools.com/css/css_padding.asphttp://w3schools.com/css/css_margin.asphttp://w3schools.com/css/css_outline.asphttp://w3schools.com/css/css_border.asphttp://w3schools.com/css/css_boxmodel.asphttp://w3schools.com/css/css_table.asphttp://w3schools.com/css/css_list.asphttp://w3schools.com/css/css_link.asphttp://w3schools.com/css/css_font.asphttp://w3schools.com/css/css_text.asphttp://w3schools.com/css/css_background.asphttp://w3schools.com/css/css_howto.asphttp://w3schools.com/css/css_id_class.asphttp://w3schools.com/css/css_syntax.asphttp://w3schools.com/css/css_intro.asphttp://w3schools.com/css/default.asphttp://www.stumbleupon.com/submit?url=http://www.w3schools.com/css/css_display_visibility.asp%26title%3DCSS%20Display%20and%20Visibilityhttp://digg.com/submit?url=http://www.w3schools.com/css/css_display_visibility.asp&title=CSS%20Display%20and%20Visibilityhttp://www.reddit.com/submit?url=http://www.w3schools.com/css/css_display_visibility.asphttp://delicious.com/save?v=5&noui&jump=close&url=http://www.w3schools.com/css/css_display_visibility.asp&title=CSS%20Display%20and%20Visibilitymailto:?&subject=CSS%20Display%20and%20Visibility&body=Take%20a%20look%20at%20this%20page%20at%20W3Schools.com:%20http://www.w3schools.com/css/css_display_visibility.asphttp://twitter.com/home?status=Currently%20reading%20http://www.w3schools.com/css/css_display_visibility.asphttp://www.facebook.com/sharer.php?u=http://www.w3schools.com/css/css_display_visibility.asphttp://adclick.g.doubleclick.net/aclk?sa=L&ai=BbCvT9hT-UZSxLYa_igeszoGwD4_fz4gDAAAAEAEg5-j6ATgAWK-p9o1IYOXC5IOkDrIBDXczc2Nob29scy5jb226AQlnZnBfaW1hZ2XIAQnaATNodHRwOi8vdzNzY2hvb2xzLmNvbS9jc3MvY3NzX2Rpc3BsYXlfdmlzaWJpbGl0eS5hc3CpAugYxmWcmoY-wAIC4AIA6gIaLzE2ODMzMTc1L1RvcExlZnRSZWN0YW5nbGX4AoHSHpADmgiYA8gGqAMB0ASQTuAEAaAGFg&num=0&sig=AOD64_22GK8zxwlPYXspgpRoRrs-uh5TOA&client=ca-pub-3440800076797949&adurl=http://w3schools.com/cert/default.asphttp://w3schools.com/about/default.asphttp://w3schools.com/forum/default.asphttp://w3schools.com/sitemap/default.asp#exampleshttp://w3schools.com/sitemap/default.asp#referenceshttp://w3schools.com/sitemap/default.asphttp://w3schools.com/sql/default.asphttp://w3schools.com/php/default.asphttp://w3schools.com/aspnet/default.asphttp://w3schools.com/xml/default.asphttp://w3schools.com/jquery/default.asphttp://w3schools.com/js/default.asphttp://w3schools.com/css/default.asphttp://w3schools.com/html/default.asphttp://w3schools.com/default.asphttp://www.w3schools.com/
  • 8/12/2019 CSS Display and Visibility

    2/2

    Top 10 Tutorials

    HTML Tutorial HTML5 Tutorial CSS Tutorial C SS3 Tutorial JavaScript Tutorial jQuery Tutorial SQL Tutorial PHP Tutorial ASP.NET Tutorial XML Tutorial

    Top 10 References

    HTML/HTML5 Reference C SS 1,2,3 Reference CSS 3 Browser Support JavaScript HTML DOM XML DOM PHP Reference jQuery Reference ASP.NET Reference HTML C olors

    Examples

    HTML Examples CSS Examples XML Examples JavaScript Examples HTML DOM Examples XML DOM Examples AJAX Examples ASP.NET Examples Razor Examples ASP Examples SVG Examples

    Quizzes

    HTML Quiz HTML5 Quiz XHTML Quiz CSS Quiz JavaScript Quiz jQuery Quiz XML Quiz ASP Quiz PHP Quiz SQL Quiz

    Color Picker

    Statistics

    Browser Statistics Browser OS Browser Display

    W3Schools is optimized for learning, testing, and training. Examples might be simplified to improve reading and basic understanding.Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content.

    While using this site, you agree to have read and accepted our terms of use and privacy policy.Copyright 1999-2013 by Refsnes Data. All Rights Reserved.

    http://w3schools.com/about/about_copyright.asphttp://w3schools.com/about/about_privacy.asphttp://w3schools.com/about/about_copyright.asphttp://w3schools.com/browsers/browsers_display.asphttp://w3schools.com/browsers/browsers_os.asphttp://w3schools.com/browsers/browsers_stats.asphttp://w3schools.com/tags/ref_colorpicker.asphttp://w3schools.com/quiztest/quiztest.asp?qtest=SQLhttp://w3schools.com/quiztest/quiztest.asp?qtest=PHPhttp://w3schools.com/quiztest/quiztest.asp?qtest=ASPhttp://w3schools.com/quiztest/quiztest.asp?qtest=XMLhttp://w3schools.com/quiztest/quiztest.asp?qtest=jQueryhttp://w3schools.com/quiztest/quiztest.asp?qtest=JavaScripthttp://w3schools.com/quiztest/quiztest.asp?qtest=CSShttp://w3schools.com/quiztest/quiztest.asp?qtest=XHTMLhttp://w3schools.com/quiztest/quiztest.asp?qtest=HTML5http://w3schools.com/quiztest/quiztest.asp?qtest=HTMLhttp://w3schools.com/svg/svg_examples.asphttp://w3schools.com/asp/asp_examples.asphttp://w3schools.com/aspnet/webpages_examples.asphttp://w3schools.com/aspnet/aspnet_examples.asphttp://w3schools.com/ajax/ajax_examples.asphttp://w3schools.com/dom/dom_examples.asphttp://w3schools.com/htmldom/dom_examples.asphttp://w3schools.com/js/js_examples.asphttp://w3schools.com/xml/xml_examples.asphttp://w3schools.com/css/css_examples.asphttp://w3schools.com/html/html_examples.asphttp://w3schools.com/tags/ref_colornames.asphttp://w3schools.com/aspnet/webpages_ref_classes.asphttp://w3schools.com/jquery/jquery_ref_selectors.asphttp://w3schools.com/php/php_ref_array.asphttp://w3schools.com/dom/dom_nodetype.asphttp://w3schools.com/jsref/default.asphttp://w3schools.com/jsref/default.asphttp://w3schools.com/cssref/css3_browsersupport.asphttp://w3schools.com/cssref/default.asphttp://w3schools.com/tags/default.asphttp://w3schools.com/xml/default.asphttp://w3schools.com/aspnet/default.asphttp://w3schools.com/php/default.asphttp://w3schools.com/sql/default.asphttp://w3schools.com/jquery/default.asphttp://w3schools.com/js/default.asphttp://w3schools.com/css3/default.asphttp://w3schools.com/css/default.asphttp://w3schools.com/html/html5_intro.asphttp://w3schools.com/html/default.asphttp://w3schools.com/css/tryit.asp?filename=trycss_visibility_collapsehttp://w3schools.com/css/tryit.asp?filename=trycss_display_blockhttp://w3schools.com/css/tryit.asp?filename=trycss_displayhttp://ads.developermedia.com/506A-591FC4D