Hosting Solutions
mobile_logo Table of Contents
seal_frontseal_back

display

The CSS display property is used to alter the default display behavior of elements. In CSS level 3 this property is shorthand for the display-inside, display-list and display-outside properties.

CSS Syntaxdisplay: inline;
JavaScript Syntaxelement.style.display = "inline";

Value

inline - elements can be placed side by side on the horizontal axis. block - elements stack on the vertical axis. inline-block - a combination of block and inline display. list-item - the element renders as a list item. inline-list-item - list items side by side on the horizontal axis. table - the element takes on a table layout. inline-table - renders an inline table. table-caption - renders a table caption. table-cell - renders a table cell. flex - renders a flex layout container. inline-flex - renders inline flex layout. grid - renders a grid layout container. inline-grid - renders inline grid layout. ruby - the element renders as a ruby layout container box. ruby-base - the element renders as a ruby base box. ruby-text - the element renders as a ruby annotation box. ruby-base-container - the element renders as a ruby base container box. ruby-text-container - the element renders as a ruby annotation container box. none - no display formatting is applied and element generates no boxes. contents - element generates no boxes but its children still generate boxes as normal.


Initial value: inline Used on: all elements Animatable: no see animatable properties CSS level: 1, 2, 3 Web standard: yes, yes, not yet what's this?

CSS Code Example

Make an element a flex container: <style> #mydiv { display: flex; background: lightgrey; } #mydiv > div { flex: auto; margin: 2px; height: 200px; background: skyblue; } </style> <div id="mydiv"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> </div> Make elements have both inline and block features: <style> #mydiv { background: black; } #mydiv > div { display: inline-block; width: 100px; height: 100px; background: skyblue; } </style> <div id="mydiv"> <div>1</div> <div>2</div> <div>3</div> </div> Make elements display as list items: <style> ol > * { display: list-item; } </style> <ol> <b>list item</b> <span>list item</span> <u>list item</u> </ol>

Official Documentation

http://www.w3.org/TR/CSS2/visuren.html#propdef-display http://www.w3.org/TR/css-display-3/#propdef-display http://www.w3.org/TR/css3-box#display http://www.w3.org/TR/css3-content#display http://www.w3.org/TR/css3-ruby#propdef-display

CSS

Properties

align contentalign itemsalign selfalignment adjustalignment baselineallanimationanimation delayanimation directionanimation durationanimation fill modeanimation iteration countanimation nameanimation play stateanimation timing functionazimuthbackface visibilitybackgroundbackground attachmentbackground blend modebackground clipbackground colorbackground imagebackground originbackground positionbackground repeatbackground sizebaseline shiftbookmark labelbookmark levelbookmark stateborderborder bottomborder bottom colorborder bottom left radiusborder bottom right radiusborder bottom styleborder bottom widthborder collapseborder colorborder imageborder image outsetborder image repeatborder image sliceborder image sourceborder image widthborder leftborder left colorborder left styleborder left widthborder radiusborder rightborder right colorborder right styleborder right widthborder spacingborder styleborder topborder top colorborder top left radiusborder top right radiusborder top styleborder top widthborder widthbottombox decoration breakbox shadowbox sizingbox snapbox suppressbreak afterbreak beforebreak insidecaption sidecaret colorchainsclearclipclip pathclip rulecolorcolor interpolation filterscolumn countcolumn fillcolumn gapcolumn rulecolumn rule colorcolumn rule stylecolumn rule widthcolumn spancolumn widthcolumnscontentcounter incrementcounter resetcounter setcropcuecue aftercue beforecursordirectiondisplaydisplay insidedisplay listdisplay outsidedominant baselinedrop initial after adjustdrop initial after aligndrop initial before adjustdrop initial before aligndrop initial sizedrop initial valueelevationempty cellsfilterflexflex basisflex directionflex flowflex growflex shrinkflex wrapfloatflood colorflood opacityflow fromflow intofontfont familyfont feature settingsfont kerningfont language overridefont sizefont size adjustfont stretchfont stylefont synthesisfont variantfont variant alternatesfont variant capsfont variant east asianfont variant ligaturesfont variant numericfont variant positionfont weightfootnote displayfootnote policygridgrid areagrid auto columnsgrid auto flowgrid auto rowsgrid columngrid column endgrid column startgrid rowgrid row endgrid row startgrid templategrid template areasgrid template columnsgrid template rowshanging punctuationheighthyphensimage orientationimage resolutioninitial letterinitial letter aligninline box alignisolationjustify contentjustify itemsjustify selfleftletter spacinglighting colorline breakline gridline heightline snapline stackingline stacking rubyline stacking shiftline stacking strategylist stylelist style imagelist style positionlist style typemarginmargin bottommargin leftmargin rightmargin topmarker sidemarquee directionmarquee loopmarquee speedmarquee stylemaskmask bordermask border modemask border outsetmask border repeatmask border slicemask border sourcemask border widthmask clipmask compositemask imagemask modemask originmask positionmask repeatmask sizemask typemax heightmax linesmax widthmax zoommin heightmin widthmin zoommix blend modemove tonav downnav leftnav rightnav upobject fitobject positionoffset afteroffset beforeoffset endoffset startopacityorderorientationorphansoutlineoutline coloroutline offsetoutline styleoutline widthoverflowoverflow styleoverflow wrapoverflow xoverflow ypaddingpadding bottompadding leftpadding rightpadding toppagepage break afterpage break beforepage break insidepage policypausepause afterpause beforeperspectiveperspective originpitchpitch rangeplay duringpositionpresentation levelquotesregion fragmentresizeresolutionrestrest afterrest beforerichnessrightrotationrotation pointruby alignruby mergeruby positionrunningshape image thresholdshape marginshape outsidesizespeakspeak asspeak headerspeak numeralspeak punctuationspeech ratestressstring settab sizetable layouttext aligntext align lasttext combine uprighttext decorationtext decoration colortext decoration linetext decoration skiptext decoration styletext emphasistext emphasis colortext emphasis positiontext emphasis styletext heighttext indenttext justifytext orientationtext overflowtext shadowtext transformtext underline positiontoptransformtransform origintransform styletransitiontransition delaytransition durationtransition propertytransition timing functionunicode bidiuser zoomvertical alignvisibilityvoice balancevoice durationvoice familyvoice pitchvoice rangevoice ratevoice stressvoice volumevolumewhite spacewidowswidthwill changeword breakword spacingword wrapwrap flowwrap throughwriting modez indexzoom