XML/CSS Style/width

Материал из Web эксперт
Перейти к: навигация, поиск

Width by percentage

<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/css" href="Style.css" ?>
<review>
  <title>A</title>
  <pullQuote>B</pullQuote>
  <paragraph1>
    C
    <reference>D</reference>
    E
    <keyword>XML</keyword>
    F
  </paragraph1>
</review>
File: Style.css
reference{
   float:left;
   width:20%;
   font-style:italic;
   padding:10px; margin:10px;
   border:solid; 
   border-width:4px; 
   border-color:#CCCCCC;
}



Width by pixel

File: Data.xml
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/css" href="Style.css" ?>
<page>
   <column1>
      <paragraph>This is a paragraph inside column one.</paragraph>
      <paragraph>This is a paragraph inside column one.</paragraph>
      <paragraph>This is a paragraph inside column one.</paragraph>
   </column1>
   <column2>
      <paragraph>This is a paragraph inside column two.</paragraph>
      <paragraph>This is a paragraph inside column two.</paragraph>
      <paragraph>This is a paragraph inside column two.</paragraph>
   </column2>
</page>
File: Style.css
page {
  display:block;
  width:470px;
  height: 400px;
  padding:10px;
  border-style:solid; border-width:2px; border-color:#000000;}
column1 {
  position:absolute;
  left:10px; top:10px;
  width:200px;
  padding:10px;
  border-style:solid; border-width:2px; border-color:#CCCCCC;}
column2 {
  position:absolute;
  left:250px; top:10px;
  width:200px;
  padding:10px;
  border-style:solid; border-width:2px; border-color:#CCCCCC;}
paragraph {
  display:block;
  padding-bottom:10px;
}