XML/CSS Style/position

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

fixed position

File: Data.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="Style.css"?>
<document>
  <title>Printer"s sample text</title>
   <pullQuote>
    quote
  </pullQuote>
  <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>
</document>
File: Style.css
title{
  position:fixed;
  height: 50px;
  width: 100%;
  color: #FFFFFF;
  font-size: 30px;
  font-weight: bold;
  background-color: #000000;
}
paragraph {
  display:block;
  padding:10px;
  border:solid 2px #A3A3A3;
  margin: 10px;
}
pullQuote {
  float:right;
  width:20%;
  font-style:italic;
  border:solid 1px #CCCCCC;
  padding:10px;
  margin:10px;
  background-color: #FFFFFF;
}



Positioning Elements Absolutely

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
 
name {
   display:block;
   position:absolute;
   left:9px
}
project {
   display:block;
   position:relative;
   left:125px
}



Relative position

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>
    <footnoteNumber>3</footnoteNumber>
    D
    <keywords>E</keywords>
    F
  </paragraph>
</page>
File: Style.css
keywords {
   display:inline;
   position:relative; right:45px;
   background-color:#ffffff;
   color:#990000;
   font-weight:bold;
   border:solid; 
   border-width:2px; 
   border-color:#CCCCCC;} 
footnoteNumber {
   position:relative; top:3px;
   display:inline;
   font-size:9pt; 
   font-weight:bold;
   color:#990000;
   border-style:solid; 
   border-width:2px; 
   border-color:#CCCCCC;}
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;
}