I want to get my first CSS layout reviewed. First of all, the related HTML code is as follows -
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title> Preferences </title>
<script src="options.js"></script>
<link rel="stylesheet" href="options.css" />
</head>
<body>
<h1> Search in New Tab - Preferences </h1>
<form id="preference-form">
<label for="search-engine"> Search Engine </label>
<select id="search-engine">
<option id="google" value="google" selected="selected"> Google </option>
<option id="bing" value="bing"> Bing </option>
<option id="yahoo" value="yahoo"> Yahoo! </option>
<option id="duckduckgo" value="duckduckgo"> DuckDuckGo </option>
<option id="wikipedia" value="wikipedia"> Wikipedia </option>
</select>
<br>
<label for="focus-search-tab"> Make the search tab active </label>
<input type="checkbox" value="focus-search-tab" id="focus-search-tab" />
</form>
</body>
</html>
I wrote the following CSS file in order to provide satisfactory presentation to the HTML -
h1
{
width : 40%;
background : #eeeeee;
box-shadow : 0 0 5px 5px #888;
margin-top : 10%;
margin-left : 30%;
margin-right : 30%;
padding-top : 10px;
padding-bottom : 10px;
text-align : center;
font-family : "Arial", "Century Gothic", "Lucida Sans Unicode";
}
form
{
width : 30%;
background : #eeeeee;
box-shadow: 0 0 5px 5px #888;
margin-top : 1%;
margin-left : 35%;
margin-right : 35%;
padding-top : 10px;
padding-bottom : 10px;
}
label
{
width : 60%;
display : inline-block;
text-align : right;
margin-top : 10px;
margin-bottom : 10px;
margin-right : 10px;
font-family : "Arial";
}
The resulting HTML document looks like this:
Basically, I wanted to avoid the use of float property. I felt that I could accomplish the same by using combinations of inline-block property, padding and margins. So, I used that. Was that the right way? Other than that, I would like to know if I did things right. Also, any improvements that make my CSS code better are welcome.
<br>
\$\endgroup\$