HTML/CSS/Basic Tags/body

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

body background-repeat: no-repeat

   <source lang="html4strict">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html>

   <head>
       <title></title>
       <style type="text/css">
           html, body {
               height: 1000px;
           }
           body {
               background-image: url("backgroundImage.jpg");
               background-repeat: no-repeat;
           }
       </style>
   </head>
   <body>
   </body>

</html>

</source>
   
  


"body" defines where to display all text, graphics, and other web page content

   <source lang="html4strict">
   
 

<html> <head> <title>body element example</title> </head>

 <body text="#0000ff" 
       bottommargin="150"
       topmargin="150">
       

Text is blue.


 
</body>

</html>


     </source>
   
  


Body margin

   <source lang="html4strict">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <style type="text/css"> body {

margin-left: 15%;
margin-right: 15%;

}

</style> </head> <body>

Lorem ipsum dolor sit amet, consectetuer adipiscing elit

</body> </html>

</source>
   
  


Set body background image and no repeat

   <source lang="html4strict">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">

   <head>
       <title></title>

<style type="text/css"> body {

background-image: url(bkgd.jpg);
background-repeat: no-repeat; 

} </style>

   </head>
   <body>
   </body>

</html>

</source>
   
  


Set <body> background image to no-repeat, and background-position to 75px 150px

   <source lang="html4strict">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">

   <head>
       <title></title>

<style type="text/css"> body {

background-image: url(bkgd.jpg);
background-repeat: no-repeat;
background-position: 75px 150px;        

} </style>

   </head>
   <body>
   </body>

</html>

</source>
   
  


Set body font: 76% arial,sans-serif

   <source lang="html4strict">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title></title> <style type="text/css">

body {

 font: 76% arial,sans-serif;

} </style> </head> <body>

Contact Form

     <form id="form1" name="form1" method="post" action="/">
   
     <label for="fmtitle" accesskey="i">Title</label>
     <select name="fmtitle" id="fmtitle">
     <option value="ms">Ms.</option>
     <option value="mrs">Mrs.</option>
     <option value="miss">Miss</option>
     <option value="mr">Mr.</option>
       </select>
       <label for="fmname" accesskey="n">Name</label>
       <input type="text" name="fmname" id="fmname" />
   
       <label for="fmemail" accesskey="e">Email</label>
       <input type="text"  name="fmemail" id="fmemail" />
   
       <label for="fmstate" accesskey="a">State/Province</label>
       <input type="text" name="fmstate" id="fmstate" />
   
       <label for="fmstate" accesskey="y">Country</label>
       <input type="text" name="fmcountry" id="fmcountry" />
   
       <label for="fmmsg">Message</label>
       <textarea name="fmmsg" accesskey="m" id="fmmsg" rows="5" cols="14"></textarea>
   
       <input type="submit" name="submit" value="send" class="submit" />
     </form>

quid pro quo

</body> </html>

</source>
   
  


Set body margin to 10%

   <source lang="html4strict">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title></title> <style type="text/css"> body { margin: 10%; } </style> </head> <body>

header 2

This is a text.

</body> </html>

</source>
   
  


Set font family for body

   <source lang="html4strict">

<html>

<head>
 <title>Set font family for body</title>
 <style type="text/css">
 body {
  font-family: verdana, arial, sans-serif;
 }
 </style>  
</head>
<body>

Title of Page

This is a sample paragraph with a <a href="http://www.wbex.ru">link</a>.

</body>

</html>

</source>
   
  


Set font size for body

   <source lang="html4strict">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">

   <head>
       <title></title>

<style type="text/css"> body {

 font-size: 62.5%;
 margin: 10% 10% 20% 10%;

} </style>

   </head>
   <body>

Header 1


This is a test.

   </body>

</html>

</source>
   
  


Set margin for body to"

   <source lang="html4strict">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">

   <head>
       <title></title>

<style type="text/css"> body {

 font-size: 62.5%;
 margin: 10% 10% 20% 10%;

} </style>

   </head>
   <body>

Header 1


This is a test.

   </body>

</html>

</source>
   
  


Set repeat to repeat-x for <body>

   <source lang="html4strict">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">

   <head>
       <title></title>

<style type="text/css"> body {

background-image: url(bkgd.jpg);
background-repeat: repeat-x;

} </style>

   </head>
   <body>
   </body>

</html>

</source>
   
  


Single paragraph in body

   <source lang="html4strict">

<?xml version = "1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns = "http://www.w3.org/1999/xhtml">

  <head>
     <title>Internet and WWW How to Program - Welcome</title>
  </head>
  <body>

Welcome to XHTML!

  </body>

</html>

</source>