With the display
property you can specifies if or how an HTML element is displayed in the web page.
- Values:
<style> #idd { display: none; } .a_block { display: block; } #idu li { display: inline; } </style> <h4>Example CSS display </h4> <p>In this HTML page a Div is not shown, displays A tags as block elements and LI with inline.</p> <div id='idd'>Removed content.</div> <a href='//coursesweb.net/css' title='CSS course' class='a_block'>CSS course</a> <a href='//coursesweb.net/html' title='HTML course' class='a_block'>HTML course</a> <ul id='idu'> <li>List 1</li> <li>List 2</li> <li>List 3</li> </ul>
The visibility
property can control if an element is visible or not. Even if the element is hidden, still affects layout and will take up space on the web page, where it should to be displayed.
<style> #idd span { visibility: hidden; } </style> <h4>Example CSS visibility</h4> <div id='idd'>This row contains a text <span>in a SPAN tag</span> that is hidden but still takes up space.</div>
position:absolute
, then, to define the visible region it's used the clip
property with rect
value that sets the shape of the visible region.<style> #idd { position: absolute; clip: rect(0, 200px, 23px, 60px); } </style> <h4>Example CSS clip</h4> <div id='idd'>Free CSS: coursesweb.net/css</div>
<ul> <li>http://coursesweb.net/html/</li> <li>http://coursesweb.net/css/</li> </ul>
.some_class { display: list-item; }
var obj = { "courses": ["php", "javascript", "ajax"] }; var jsonstr = JSON.stringify(obj); alert(jsonstr); // {"courses":["php","javascript","ajax"]}
$strhtml = '<body><div id="dv1">CoursesWeb.net</div></body>'; $dochtml = new DOMDocument(); $dochtml->loadHTML($strhtml); $elm = $dochtml->getElementById("dv1"); echo $elm->nodeValue; // CoursesWeb.net