In: Computer Science
Remove inline style to an external file
<!DOCTYPE html>
<html>
<head>
<title>PROBLEM</title>
</head>
<body>
<form>
<table style="color:white;background-color:blue;border:solid
black 7px;border-radius:25px;">
<tr><th colspan="2"
style="color:white;background-color:black;border:solid black
2px;outline:solid black 2px;">SQUARE
PROBLEM</th></tr>
<tr> <td><label>Enter
side:</label></td><td> <input type="text"
style="background-color:#DEDEE6;border:4px solid red;"/>
</td> </tr>
<tr>
<td><label>Area:</label></td><td>
<input type="text" readonly
style="background-color:#DEDEE6;border:4px solid yellow;"/>
</td> </tr>
<tr>
<td><label>Perimeter:</label></td>
<td> <input type="text" readonly
style="background-color:#DEDEE6;border:4px solid yellow;"/>
</td> </tr>
<tr>
<td colspan="2" >
<center>
<input type="button" value="Area"
style="color:white;background-color:black;border:1px solid
red;"/>
<input type="button" value="Perimeter"
style="color:white;background-color:black;border:1px solid
white;"/>
<input type="button" value="Both"
style="color:white;background-color:black;border:1px solid
red;"/>
<input type="button" value="Clear"
style="color:white;background-color:black;border:1px solid
white;"/>
</center>
</td>
</tr>
</table>
</form>
</body>
</html>
From the external style sheet, you can change the look of an entire website by changing just one file!
Each HTML page must include a reference to the external style sheet file inside the <link> element, inside the head section.
index.html
<!-- Solution for Remove inline style to an external file -->
<!DOCTYPE html>
<html>
<head>
<!-- External Style Sheet was defined with in the <link>
element, inside the head section of an html page -->
<link rel="stylesheet" href="Style.css"/>
<!-- End of External Style Sheet -->
<title>Solution</title>
</head>
<body>
<form>
<table class="table-top">
<tr><th colspan="2" class="table-cellhead">SQUARE
PROBLEM</th></tr>
<tr> <td><label>Enter
side:</label></td><td> <input type="text"
class="table-cell"/> </td> </tr>
<tr>
<td><label>Area:</label></td><td>
<input type="text" readonly class="table-cell1"/> </td>
</tr>
<tr>
<td><label>Perimeter:</label></td>
<td> <input type="text" readonly class="table-cell2"/>
</td> </tr>
<tr>
<td colspan="2" >
<center>
<input type="button" value="Area"
class="table-perimeter-cell"/>
<input type="button" value="Perimeter"
class="table-perimeter-cell1"/>
<input type="button" value="Both"
class="table-perimeter-cell2"/>
<input type="button" value="Clear"
class="table-perimeter-cell3"/>
</center>
</td>
</tr>
</table>
</form>
</body>
</html>
An External Stylesheet must be saved with a .css extension.
Style.css
.table-top{
color:white;
background-color:blue;
border:solid black 7px;
border-radius:25px;
}
.table-cellhead{
color:white;
background-color:black;
border:solid black 2px;
outline:solid black 2px;
}
.table-cell{
background-color:#DEDEE6;
border:4px solid red;
}
.table-cell1{
background-color:#DEDEE6;
border:4px solid yellow;
}
.table-cell2{
background-color:#DEDEE6;
border:4px solid yellow;
}
.table-perimeter-cell{
color:white;
background-color:black;
border:1px solid red;
}
.table-perimeter-cell1{
color:white;
background-color:black;
border:1px solid white;
}
.table-perimeter-cell2{
color:white;
background-color:black;
border:1px solid red;
}
.table-perimeter-cell3{
color:white;
background-color:black;
border:1px solid white;
}