SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
Thread: noob: css CDATA
-
Oct 9, 2007, 12:31 #1
- Join Date
- Oct 2006
- Posts
- 216
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
noob: css CDATA
Here is the css content inside html:
Code:<style type="text/css" title="defaultStyle"> /*<![CDATA[*/ <!-- SOME CSS CONTENT --> /*]]>*/
When link the css file like this:
Code:<link rel="stylesheet" href="temp.css" type="text/css" />
Code:/*<![CDATA[*/ <!-- and --> /*]]>*/
-
Oct 9, 2007, 13:22 #2
- Join Date
- Jan 2003
- Location
- Hampshire UK
- Posts
- 40,556
- Mentioned
- 183 Post(s)
- Tagged
- 6 Thread(s)
You don't need that code in the css file as it is only necessary when the css is embedded in the xhtml page.
The only thing in a css file is the css and css comments /* etc */
-
Oct 9, 2007, 14:48 #3
- Join Date
- Oct 2006
- Posts
- 216
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
noob: can you do this in css and html
can you have this in css and in html?:
In css file:
Code:#center_html { display: table; overflow: visible; } #center_body { background: #f0ffe1; display: table-cell; vertical-align: middle; }
Code:<html id="center_html" > <body id="center_body" > </body> </html>
In css:
Code:#center html { display: table; overflow: visible; } #center body { background: #f0ffe1; display: table-cell; vertical-align: middle; }
Code:<div id="center"> <html> <body> </body> </html> </div>
-
Oct 9, 2007, 15:02 #4
- Join Date
- Jan 2003
- Location
- Hampshire UK
- Posts
- 40,556
- Mentioned
- 183 Post(s)
- Tagged
- 6 Thread(s)
Hi,
You can't put divs above the html tag as html is the root element. You should also know that display:table doesn't work in IE (all versions including ie7) so there is not much point in using it unless you just want to support other browsers.
You will need to add a height and width of you want to vertically and horizontally center something.
Code:html { display: table; overflow: visible; height:100%; text-align:center; width:100% } body { background: #f0ffe1; display: table-cell; vertical-align: middle; }
-
Oct 9, 2007, 16:03 #5
- Join Date
- Oct 2006
- Posts
- 216
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
thank you...for taking the time to answer my questions.
-
Oct 9, 2007, 19:20 #6
- Join Date
- Sep 2005
- Location
- Sydney, NSW, Australia
- Posts
- 16,875
- Mentioned
- 25 Post(s)
- Tagged
- 1 Thread(s)
Also you don't need ids on the html and body tag as there is only one of each so you can reference them by their tagnames of html and body without needing ids.
Stephen J Chapman
javascriptexample.net, Book Reviews, follow me on Twitter
HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
<input name="html5" type="text" required pattern="^$">
-
Oct 10, 2007, 04:20 #7
- Join Date
- Dec 2004
- Location
- Derbyshire - UK
- Posts
- 2,651
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
True in this case but there may be times when your CSS file is styling multiple pages in which case it's a common method of providing styles to a specific page by providing a unique ID on the body of individual pages.
In this case though I completely agree with Stephen.
Bookmarks