XML/CSS Style/Padding

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

Padding and margin

File: Data.xml

<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/css" href="Style.css" ?>
<page>
   <pageNumber>1</pageNumber>
   <paragraph>A
      <reference>B</reference>
      <keyword>X</keyword>
   </paragraph>
   <paragraph>C</paragraph>
</page>

File: Style.css
page {
   display:block;
   padding:10px;
   margin:10px;
   border-style:solid; 
   border-width:4px; 
   border-color:#000000;
}
pageNumber {
   display:inline;
   font-style:italic;
   border-style:solid; 
   border-width:4px; 
   border-color:#CCCCCC;
}
paragraph {
   display:block;
   padding:10px;
   border:solid; 
   border-width:4px; 
   border-color:#CCCCCC;
}
reference {
   display:inline;
   font-style:italic;
   color:#CC3333;
   border:solid; 
   border-width:2px; 
   border-color:#CCCCCC;
}
keyword {
   display:inline;
   font-weight:bold;
   color:#990000;
   border:solid; 
   border-width:2px; 
   border-color:#CCCCCC;
}



Padding is extra space around the contents of an element but inside the border.

File: Data.xml
<?xml version="1.0" ?>
<?xml-stylesheet type="text/css" href="Style.css" ?>
<employees>
  <name language="English">T1</name>
  <name language="Latin">T2</name>
  <projects>
    <project>project1</project>
    <project>project2</project>
    <project>project3</project>
  </projects>
  <weight>3 points</weight>
  <length>3 years</length>
</employees>
File: Style.css

employees {
   display:block
}
name {
   display:block;
   position:absolute;
   left:9px
}
projects{
   display:block;
   border:medium dotted red;
   padding:5px
}
project {
   display:block;
   position:relative;
   left:125px;
   width:340px;
   border:thin solid red;
   padding:5px
}



padding-top

File: Data.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="boxes9.css"?>
<facingPages>
  <pageLeft>
    <paragraph>
      Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
       nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut
       wisi enim ad minim veniam, quis nostrud exercitation ulliam corper suscipit
       lobortis nisl ut aliquip ex ea commodo consequat. Duis autem veleum iriure dolor
       in hendrerit in vulputate velit esse molestie consequat, vel willum lunombro
       dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio
       dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te
       feugait nulla facilisi. 
     </paragraph>
  </pageLeft>
  <pageRight>
    <paragraph>
      Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
       nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut
       wisi enim ad minim veniam, quis nostrud exercitation ulliam corper suscipit
       lobortis nisl ut aliquip ex ea commodo consequat. Duis autem veleum iriure dolor
       in hendrerit in vulputate velit esse molestie consequat, vel willum lunombro
       dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio
       dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te
       feugait nulla facilisi. 
     </paragraph>
  </pageRight>
</facingPages>
File: Style.css
facingPages {
  display:block;
  width:90%;
  border:solid 4px #000000;
  padding: 10px;
  margin:10px;
}
pageLeft {
  position:absolute;
  top:10px;
  right:auto;
  bottom:auto;
  left:10px;
  width:40%;
  border:solid 2px #000000;
  padding: 10px;
  margin:10px;
}
pageRight {
  position:absolute;
  top:10px;
  right:10px;
  bottom:auto;
  left:auto;
  width:40%;
  width:40%;
  border:solid 2px #000000;
  padding: 10px;
  margin:10px;
}
paragraph {
  display:block;
  padding-top:10px;
  border:solid 2px #CCCCCC;
  padding: 10px;
  margin:10px:
}