CSS & PHP Practise Sheet
CSS & PHP Practise Sheet
CSS & PHP Practise Sheet
There are three ways you can apply CSS to an HTML document. These methods are all outlined below.
One way to apply CSS to HTML is by using the HTML attribute style. Building on the above
example with the red background color, it can be applied like this:
<html>
<head>
</head>
<body style="background-color:#FF0000;">
</body>
</html>
Method 2: Internal (the tag style)
Another way is to include the CSS codes using the HTML tag <style>. For
example like this:
<html>
<head>
<style type="text/css">
background-color:#FF0000;
</style>
</head>
<body>
</body>
</html>
Example
<!DOCTYPEhtml>
<html>
<head>
<style>
body
{
background-color:#d0e4fe;
}
h1
{
color:orange;
text align:center;
}
p
{
font-family:"Times New Roman";
font-size:20px;
}
</style>
</head>
<body>
<h1> Internal CSS Example </h1>
<p>This is a paragraph.</p>
</body>
</html>
Method 3: External Method (link to a style sheet).
External style sheets are separate files full of CSS instructions (with the file extension .css).
When any web page includes an external style sheet, its look and feel will be controlled by this
CSS file (unless you decide to override a style using one of these next two types). This is how
you change a whole website at once. And that's perfect if you want to keep up with the latest
fashion in web pages without rewriting every page!
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Code for mystyle.css
Body
h1
color: navy;
margin-left: 20px;
}
Navigation Bar
<html>
<head>
<style>
ul
{
list-style-type: none;
margin:0;
padding:0;
overflow:hidden;
}
li
{
float:left;
}
li a
{
display:block;
padding:10px;
background-color:#aaaaaa;
}
</style>
</head>
<body>
<ul>
<li><a href="list.html">Home</a></li>
<li><a href="table.html">About Us</a></li>
<li><a href="nav.html">Community</a></li>
<li><a href="form.html">Careers</a></li>
</ul>
</body>
</html>
HTML & CSS
Write the HTML code for generating the form as shown below. Apply the internal CSS to
following form to change the font size of the heading to 6pt and change the color to red and also
change the background color to yellow.
iii) Place your city name at the top of page in large text and in blue color.
iv) Add names of the landmarks in your city, each in different color, style and font
v) Add any image at the bottom. (Use inline CSS to format the web page)
3) Write a program using html with following CSS specifications
iii. The heading should be large –with font ''comic sans ms''
iv. The description of the company should be displayed in blue color in a paragraph.
List of Books
Item Item Name Price
No Rs Paise
1 Programming in Python 500 50
2 Programming in Java 345 00
5) Design HTML 5 Page Using CSS Which Displays the following Navigation Bar.
6) Write a PHP script to create a chess board using CSS on table cells.
PHP Practical
welcome.php
<?php
?>
info.php
<?php
phpinfo();
?>
add.php
<?php
$a=10;
$b=20;
$c=$a + $b;
?>
Solve Following:-
2. Write a PHP script for the following: Design a form to accept two numbers from the user.
Give options to choose an arithmetic operation (Use Radio Button). Display the result
submit button click.
3. Write a PHP script to change the preferences of your web page like font style (face), font
size, font color, background color. Display selected settings as an output.
4. Write a PHP script to accept two strings from user. Write a user defined strcat() function
to concatenate these two strings and display output on submit button click.
Login:-
Login with
……..
and so on………