Advertisement
Guest User

Untitled

a guest
Nov 6th, 2014
481
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.71 KB | None | 0 0
  1. Your code looks quite good actually.
  2. There are a few things you can and should improve.
  3.  
  4. **General points:**
  5.  
  6. You are using inconsistent quotes.<br>
  7. You have this line on your `<head>`:
  8.  
  9. <link href='http://fonts.googleapis.com/css?family=Ruda' rel='stylesheet' type='text/css'>
  10.  
  11. But on the rest of your code, you use `""` instead.<br>
  12. The quotes itself make no difference in functionality, but we should keep consistency.
  13.  
  14. All your paths are relative.<br>
  15. This doesn't pose any problem now, but it will be a nightmare if you use some server-side scripting languages and make internationalization of your code.
  16.  
  17. <hr>
  18.  
  19. Your indentation is a little off.<br>
  20. This makes your code harder to read and maintain.
  21.  
  22. <hr>
  23.  
  24. You are using this, to set the charset:
  25.  
  26. <meta charset="utf-8">
  27.  
  28. While this is fine, some older browsers don't support it.<br>
  29. You should add this like too:
  30.  
  31. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  32.  
  33. <hr>
  34.  
  35. In terms of SEO, your code doesn't have a single header.<br>
  36. Using `<h1>`, `<h2>`, `<h3>` and so on will help greatly.
  37.  
  38. <hr>
  39.  
  40. Some classes are completely useless and I have removed them.<br>
  41. The css selectors were updated.
  42.  
  43. <hr>
  44.  
  45. And now, lets tackle file by file.
  46.  
  47. File home.html
  48. ==============
  49.  
  50. The first thing that popped to me what this line:
  51.  
  52. <content class="content">
  53.  
  54. This tag doesn't exist.<br>
  55. It was proposed but it never took off.<br>
  56. The only source about this is here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/content <br>
  57. But that is incomplete.<br>
  58. Use the `<section>` tag instead, like this:
  59.  
  60. <section class="content">
  61.  
  62. <hr>
  63.  
  64. Inside the `<content>` tag, you are using `<p>` with `<br>`.<br>
  65. This means that something isn't right with your CSS.<br>
  66. The `<p>` tag is a block element, therefore is makes a new line automatically.<br>
  67. If you require the use of `<br>`s, join all the `<p>`s in only one, like this:
  68.  
  69. <p>
  70. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet felis nulla. Aliquam at ligula porttitor, eleifend quam at, congue urna. Duis vehicula aliquam lectus, sed pharetra orci aliquet et. Pellentesque felis sem, auctor a erat eu, dignissim gravida enim. Ut eget est justo. In ac pharetra ipsum. In a metus feugiat, aliquam metus in, lobortis lectus. Integer non dolor felis. Suspendisse condimentum a ex faucibus tempus. Curabitur blandit mi aliquam, aliquam libero et, hendrerit tortor. Vivamus non tortor ultrices, auctor arcu ut, luctus risus. Ut a elementum leo, quis porta augue.
  71.  
  72. <br>
  73.  
  74. Suspendisse eget enim arcu. In arcu dui, faucibus eget vehicula eget, hendrerit ut urna. Nunc venenatis vestibulum luctus. Etiam magna purus, posuere rutrum diam sed, porttitor condimentum velit. Proin dapibus ligula eget tellus efficitur, a maximus lectus tristique. Duis nunc risus, vehicula at dignissim sed, vehicula ut libero. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec sed odio lobortis, viverra ipsum ut, tincidunt enim. Fusce est nulla, viverra sed blandit eget, ullamcorper sed ipsum. Donec laoreet euismod tortor, vel dapibus turpis semper a. Duis et lacus nec odio volutpat eleifend id ac mauris. Duis non orci sed urna congue rutrum. Pellentesque id dapibus eros, ut cursus elit. Cras at tellus id nulla posuere tempor. Sed eu pulvinar nibh. Sed eleifend pellentesque imperdiet.
  75.  
  76. <br>
  77.  
  78. Nunc et orci mauris. Nulla at odio lorem. Donec condimentum commodo elit vitae aliquam. Integer eget sagittis elit. Nulla facilisi. Aenean vel vehicula felis. Integer nec sapien et dui semper sagittis. Vivamus eu ex ut urna mattis iaculis. Maecenas auctor accumsan iaculis. Donec in arcu nisl.
  79. </p>
  80.  
  81. <hr>
  82.  
  83. Another thing you can change is to wrap the content of the `<content>` tag in an `<article>`.<br>
  84. This allows you to have multiple `<article>`s.<br>
  85.  
  86. The final look of this part of the code, with SEO changes:
  87.  
  88. <section class="content">
  89. <h2>Welcome to our website</h2> <!-- SEO change, text example -->
  90. <article>
  91. <h3>Welcome to our website</h3> <!-- SEO change, text example -->
  92. <img src="images/masthead.jpg" alt="Masthead">
  93. <p>
  94. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet felis nulla. Aliquam at ligula porttitor, eleifend quam at, congue urna. Duis vehicula aliquam lectus, sed pharetra orci aliquet et. Pellentesque felis sem, auctor a erat eu, dignissim gravida enim. Ut eget est justo. In ac pharetra ipsum. In a metus feugiat, aliquam metus in, lobortis lectus. Integer non dolor felis. Suspendisse condimentum a ex faucibus tempus. Curabitur blandit mi aliquam, aliquam libero et, hendrerit tortor. Vivamus non tortor ultrices, auctor arcu ut, luctus risus. Ut a elementum leo, quis porta augue.
  95.  
  96. <br>
  97.  
  98. Suspendisse eget enim arcu. In arcu dui, faucibus eget vehicula eget, hendrerit ut urna. Nunc venenatis vestibulum luctus. Etiam magna purus, posuere rutrum diam sed, porttitor condimentum velit. Proin dapibus ligula eget tellus efficitur, a maximus lectus tristique. Duis nunc risus, vehicula at dignissim sed, vehicula ut libero. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec sed odio lobortis, viverra ipsum ut, tincidunt enim. Fusce est nulla, viverra sed blandit eget, ullamcorper sed ipsum. Donec laoreet euismod tortor, vel dapibus turpis semper a. Duis et lacus nec odio volutpat eleifend id ac mauris. Duis non orci sed urna congue rutrum. Pellentesque id dapibus eros, ut cursus elit. Cras at tellus id nulla posuere tempor. Sed eu pulvinar nibh. Sed eleifend pellentesque imperdiet.
  99.  
  100. <br>
  101.  
  102. Nunc et orci mauris. Nulla at odio lorem. Donec condimentum commodo elit vitae aliquam. Integer eget sagittis elit. Nulla facilisi. Aenean vel vehicula felis. Integer nec sapien et dui semper sagittis. Vivamus eu ex ut urna mattis iaculis. Maecenas auctor accumsan iaculis. Donec in arcu nisl.
  103. </p>
  104. </article>
  105. </section>
  106.  
  107. File contact.html:
  108. ==================
  109.  
  110. You have those lines of code:
  111.  
  112. <div>
  113. <iframe id="contactform" src="https://docs.google.com/forms/d/1bUTpWyMaouMEQH68trQlyyx5I8EU5YQXrGvj10NNdrw/viewform?embedded=true" width="690" height="1050" frameborder="0" marginheight="0" marginwidth="0">Loading...
  114. </iframe>
  115. </div>
  116.  
  117. First, this `<div>` tag seems to have the same function as the `<content>` on the file `home.html`.<br>
  118. This should be a section.<br>
  119.  
  120. <hr>
  121.  
  122. Another issue here is that your `<iframe>` has lots of invalid properties.<br>
  123. Those properties **must** be removed: they generate invalid html5 code.
  124.  
  125. <hr>
  126.  
  127. This isn't an issue but your `<iframe>` has `Loading...` as it's content.<br>
  128. This will be shown when a browser doesn't support `<iframe>`s.<br>
  129. It is highly misleading, making the used think that something will show when it won't.<br>
  130.  
  131. <hr>
  132.  
  133. Applying all the changes:
  134.  
  135. <section class="content">
  136. <h2>Contact us</h2>
  137. <iframe id="contactform" src="https://docs.google.com/forms/d/1bUTpWyMaouMEQH68trQlyyx5I8EU5YQXrGvj10NNdrw/viewform?embedded=true">
  138. <div class="error">
  139. <h3>Error while loading the form</h3>
  140. <p>
  141. Your browser doesn't seem to support iframes.<br>
  142. To contact us, you can <a href="https://docs.google.com/forms/d/1bUTpWyMaouMEQH68trQlyyx5I8EU5YQXrGvj10NNdrw/viewform?embedded=true" target="_blank">view our form on a new window.</a>
  143. </p>
  144. </div>
  145. </iframe>
  146. </section>
  147.  
  148. File style.css
  149. ==============
  150.  
  151. There aren't any issues with your css.
  152.  
  153. Obviously there is room for improvements, so, I will post them here.<br>
  154. I won't post the changes I did on the selectors.
  155.  
  156. <hr>
  157.  
  158. Your body grows with the size of the screen.<br>
  159. Set a maximum width on it.<br>
  160. I saw that setting it to 640px actually looked quite well.
  161.  
  162. <hr>
  163.  
  164. Your styles that you had defined on the `<iframe>` were moved and shrinked into this:
  165.  
  166. #contactform {
  167. display:block;
  168. width:100%; //you must set a width for iframes
  169. height:1010px; //this works well
  170. border:0px; //removes the ugly border
  171. }
  172.  
  173. But this raises a problem: The page grows 140px when resized to the absolutely possible minimum.<br>
  174. You can either set a bigger height, as you had, or you can use some `@media` queries.
  175.  
  176. To your menu, I did this:
  177.  
  178. header li {
  179. display: inline-block;
  180. font-size: 1.5em;
  181. font-weight: 700;
  182. letter-spacing: 0.5px;
  183. margin: 0px 25px;
  184. min-width: 70px;
  185. text-align: center;
  186. width: 13%;
  187. }
  188. header li a{
  189. display: inline-block;
  190. width: 100%;
  191. }
  192.  
  193. I added, the `display: inline-block;` and the `width: 100%;` to each item in the menu.<br>
  194. It looks great (in my opinion) to a minimum width of 80px.
  195.  
  196. Another thing was that I changed your `font-size` from 150% to 1.5em.
  197.  
  198. The final code:
  199. ===============
  200.  
  201. **style.css:**
  202.  
  203. body {
  204. font-family: 'Ruda', sans-serif;
  205. font-size: 87.5%;
  206. background-color:#efefef;
  207. margin: 0 auto;
  208. width: 100%;
  209. max-width:640px;
  210. clear:both;
  211. line-height:1.5;
  212. }
  213. /*
  214. ======= MAIN HEADER =======
  215. */
  216. header {
  217. margin:5px auto 5px auto;
  218. }
  219. header img {
  220. width: 15%;
  221. display: inline;
  222. margin: 0 auto 0 auto;
  223. padding: 5px 0 5px 0;
  224. }
  225. header li {
  226. display: inline-block;
  227. font-size: 1.5em;
  228. font-weight: 700;
  229. letter-spacing: 0.5px;
  230. margin: 0px 25px;
  231. min-width: 70px;
  232. text-align: center;
  233. width: 13%;
  234. }
  235. header li a{
  236. display: inline-block;
  237. width: 100%;
  238. }
  239. header nav {
  240. background-color: #00457C;
  241. }
  242. header ul {
  243. text-align: center;
  244. padding: 10px;
  245. }
  246. header h1 {
  247. color: #193365;
  248. display: inline;
  249. font-size: 300%;
  250. padding: 0px 0px 0px 50px;
  251. }
  252. /*
  253. ======= SOCIAL BAR =======
  254. */
  255. #socialbar {
  256. text-align: right;
  257. }
  258. #socialbar h2 {
  259. display: inline;
  260. padding-right: 5px;
  261. }
  262. #socialbar h1 {
  263. display: block;
  264. font-size: 2.4em;
  265. }
  266. #socialbar img {
  267. width: 4%;
  268. padding: 0px 5px 0px 5px;
  269. }
  270. #socialbar a {
  271. display:inline;
  272. }
  273. #logo {
  274. float:left;
  275. width:12%;
  276. }
  277.  
  278. /*
  279. ======= MAIN CONTENT =======
  280. */
  281.  
  282. .content p {
  283. width: 90%;
  284. margin: 0 auto;
  285. padding: 10px 0px 10px 0px;
  286. }
  287. .content img {
  288. width:75%;
  289. display:block;
  290. margin: 0 auto;
  291. padding: 5px 0 5px 0;
  292. }
  293. #contactform {
  294. display:block;
  295. width:100%;
  296. height:1050px;
  297. border:0px;
  298. }
  299. a {
  300. text-decoration: none;
  301. text-transform:uppercase;
  302. color: white;
  303. }
  304. a:hover {
  305. text-decoration: underline;
  306. }
  307. /*
  308. ======= MAIN FOOTER =======
  309. */
  310. footer {
  311. background-color: #00457C;
  312. font-size: 150%;
  313. margin: 0px auto 0px auto;
  314. color:white;
  315. text-align: right;
  316. width:100%;
  317. }
  318. footer p {
  319. padding: 10px;
  320. }
  321.  
  322. **contact.html**
  323.  
  324. <!DOCTYPE html>
  325. <html lang="en">
  326. <head>
  327. <title>Kiwanis of Kennett Square</title>
  328. <meta charset="utf-8">
  329. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  330. <link href="css/styles.css" type="text/css" rel="stylesheet">
  331. <link href="http://fonts.googleapis.com/css?family=Ruda" rel="stylesheet" type="text/css">
  332. </head>
  333.  
  334. <body>
  335. <div id="page">
  336. <header>
  337. <div id="socialbar">
  338. <img id="logo" src="images/kiwanis_logo_transparent.png" alt="Kiwanis Logo">
  339. <h1 align="right">Kiwanis of Kennett Square</h1>
  340. <h2>Find us on: </h2>
  341. <a href="https://www.facebook.com/kiwanisKSQ" target="_blank"><img id="socialLogo" src="images/facebook.png" alt="Facebook"></a>
  342. <a href="http://www.twitter.com" target="_blank"><img id="socialLogo" src="images/twitter.png" alt="Twitter"></a>
  343. <a href="http://www.instagram.com" target="_blank"><img id="socialLogo" src="images/instagram.png" alt="Instagram"></a>
  344. </div>
  345. <nav>
  346. <ul>
  347. <li><a href="index.html">Home</a></li>
  348. <li><a href="about.html">About</a></li>
  349. <li><a href="photos.html">Photos</a></li>
  350. <li><a href="contact.html">Contact</a></li>
  351. </ul>
  352. </nav>
  353. </header>
  354.  
  355. <section class="content">
  356. <h2>Contact us</h2>
  357. <iframe id="contactform" src="https://docs.google.com/forms/d/1bUTpWyMaouMEQH68trQlyyx5I8EU5YQXrGvj10NNdrw/viewform?embedded=true">
  358. <div class="error">
  359. <h3>Error while loading the form</h3>
  360. <p>
  361. Your browser doesn't seem to support iframes.<br>
  362. To contact us, you can <a href="https://docs.google.com/forms/d/1bUTpWyMaouMEQH68trQlyyx5I8EU5YQXrGvj10NNdrw/viewform?embedded=true" target="_blank">view our form on a new window.</a>
  363. </p>
  364. </div>
  365. </iframe>
  366. </section>
  367.  
  368. <footer>
  369. <p>Email us at: <a href="mailto:kiwanisksq@gmail.com" target="_top">KIWANISKSQ@GMAIL.COM</a></p>
  370. </footer>
  371.  
  372. </div>
  373. </body>
  374. </html>
  375.  
  376. **home.html:**
  377.  
  378. <!DOCTYPE html>
  379. <html lang="en">
  380. <head>
  381. <title>Kiwanis of Kennett Square</title>
  382. <meta charset="utf-8">
  383. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  384. <link href="/css/styles.css" type="text/css" rel="stylesheet">
  385. <link href="http://fonts.googleapis.com/css?family=Ruda" rel="stylesheet" type="text/css">
  386. </head>
  387.  
  388. <body>
  389. <div id="page">
  390. <header>
  391. <div id="socialbar">
  392. <img id="logo" src="images/kiwanis_logo_transparent.png" alt="Kiwanis Logo">
  393. <h1 align="right">Kiwanis of Kennett Square</h1>
  394. <h2>Find us on: </h2>
  395. <a href="https://www.facebook.com/kiwanisKSQ" target="_blank"><img id="socialLogo" src="images/facebook.png" alt="Facebook"></a>
  396. <a href="http://www.twitter.com" target="_blank"><img id="socialLogo" src="images/twitter.png" alt="Twitter"></a>
  397. <a href="http://www.instagram.com" target="_blank"><img id="socialLogo" src="images/instagram.png" alt="Instagram"></a>
  398. </div>
  399. <nav>
  400. <ul>
  401. <li><a href="index.html">Home</a></li>
  402. <li><a href="about.html">About</a></li>
  403. <li><a href="photos.html">Photos</a></li>
  404. <li><a href="contact.html">Contact</a></li>
  405. </ul>
  406. </nav>
  407. </header>
  408.  
  409. <section class="content">
  410. <h2>Welcome to our website</h2> <!-- SEO change, text example -->
  411. <article>
  412. <h3>Welcome to our website</h3> <!-- SEO change, text example -->
  413. <img src="images/masthead.jpg" alt="Masthead">
  414. <p>
  415. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet felis nulla. Aliquam at ligula porttitor, eleifend quam at, congue urna. Duis vehicula aliquam lectus, sed pharetra orci aliquet et. Pellentesque felis sem, auctor a erat eu, dignissim gravida enim. Ut eget est justo. In ac pharetra ipsum. In a metus feugiat, aliquam metus in, lobortis lectus. Integer non dolor felis. Suspendisse condimentum a ex faucibus tempus. Curabitur blandit mi aliquam, aliquam libero et, hendrerit tortor. Vivamus non tortor ultrices, auctor arcu ut, luctus risus. Ut a elementum leo, quis porta augue.
  416.  
  417. <br>
  418.  
  419. Suspendisse eget enim arcu. In arcu dui, faucibus eget vehicula eget, hendrerit ut urna. Nunc venenatis vestibulum luctus. Etiam magna purus, posuere rutrum diam sed, porttitor condimentum velit. Proin dapibus ligula eget tellus efficitur, a maximus lectus tristique. Duis nunc risus, vehicula at dignissim sed, vehicula ut libero. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec sed odio lobortis, viverra ipsum ut, tincidunt enim. Fusce est nulla, viverra sed blandit eget, ullamcorper sed ipsum. Donec laoreet euismod tortor, vel dapibus turpis semper a. Duis et lacus nec odio volutpat eleifend id ac mauris. Duis non orci sed urna congue rutrum. Pellentesque id dapibus eros, ut cursus elit. Cras at tellus id nulla posuere tempor. Sed eu pulvinar nibh. Sed eleifend pellentesque imperdiet.
  420.  
  421. <br>
  422.  
  423. Nunc et orci mauris. Nulla at odio lorem. Donec condimentum commodo elit vitae aliquam. Integer eget sagittis elit. Nulla facilisi. Aenean vel vehicula felis. Integer nec sapien et dui semper sagittis. Vivamus eu ex ut urna mattis iaculis. Maecenas auctor accumsan iaculis. Donec in arcu nisl.
  424. </p>
  425. </article>
  426. </section>
  427.  
  428. <footer>
  429. <p>Email us at: <a href="mailto:kiwanisksq@gmail.com" target="_top">KIWANISKSQ@GMAIL.COM</a></p>
  430. </footer>
  431.  
  432. </div>
  433. </body>
  434. </html>
  435.  
  436.  
  437. **Notice:** I have kept the path **relative**.<br>
  438. This was on purpose to avoid troubles when you test the code.<br>
  439. **Before testing my cope, copy the whole folder with the files and use that copy, not the original folder!**
  440.  
  441. Side notes:
  442. ===========
  443.  
  444. You could reduce the code by using a server-side script language, like php.<br>
  445. This would make your website much more flexible and re-usable.
  446.  
  447. You could also use a very basic database, using sqlite ( http://www.sqlite.org/ ) or even a full mysql database.<br>
  448. This would allow you to create a basic CMS and use it to manage the website.<br>
  449. Use this as an exercise to create your re-usable framework.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement