January 21, 201313 yr I'm not new to HTML and CSS, but I am new to making my own website. Do most people start of with a simple website template and create from scratch later? Because I tried create from scratch and I have no idea how to plan the codes. When to use different tags...Is it because I do not have enough knowledge on both HTML and CSS?
January 21, 201313 yr I make my own template and work from that. Generally, you're going to need your doctype, charset, title, metas, stylesheets and javascripts in your head. Then you'll need a section/div for each area that you're going to add. Just keep practicing! If you understand HTML and CSS then start reading other developers source code on simple webpages without too much going on. Practice. Practice. Practice. My friend.
January 21, 201313 yr Author I make my own template and work from that. Generally, you're going to need your doctype, charset, title, metas, stylesheets and javascripts in your head. Then you'll need a section/div for each area that you're going to add. Just keep practicing! If you understand HTML and CSS then start reading other developers source code on simple webpages without too much going on. Practice. Practice. Practice. My friend. I do read other people's codes, but it doesn't seem to be helping me on planning my own codes...
January 21, 201313 yr You should be thinking about how your going to code it as you design it... Try taking your design and writing how your going to code it over the top... if you have an image of your website, PM me it and I'll get you started.
January 21, 201313 yr Author Here is my codes <!DOCTYPE html> <head> <meta charset="utf-8"> <title>Ask Smartphones - review phones that no or little reviews</title> <meta name="description" content="Smartphones review site"> <link rel="stylesheet" type="text/css" href="css/main.css"> </head> <!--begin body--> <body> <div class="logo"> <a href="index.html">Ask SP!</a> </div> <div class="menu"> <ul id="menu" class="container"> <li><a href="index.html">Search</a></li> <li><a href="index.html">Forums</a></li> <li><a href="index.html">Blog</a></li> </ul> </div> <div class="content"> <img src="images/Icontelephone.png" alt="click here to search"> </div> </body> CSS body { background-color:#3366CC; margin:10px; } .menu { color:#000000; height: 78px; width:990px; } .menu logo{ float:left; overflow: hidden; margin: 60px; } .menu a { color:#ffffff; margin-top: 60px; padding:auto; float:right; } .content { margin-top: 30px; } Edited January 22, 201313 yr by Renaissance-Design Code formatting
January 21, 201313 yr Okay... First off, I'd put both your navigation and logo in a <header> and get rid of those DIVs as they aren't needed - the logo and menu can be selected without them being in DIVs. <header> <a href="index.html">Ask SP!</a> <ul id="menu" class="container"> <li><a href="index.html">Search</a></li> <li><a href="index.html">Forums</a></li> <li><a href="index.html">Blog</a></li> </ul> </header> Use id rather than class for unique elements. Add text-decoration: none; to your .menu a to get rid of the underline. Add this to your styles to get rid of the bullet points, position your navigation and create a gap between each link... .menu li { float: right; /* floats to the right */ list-style-type: none; /* gets rid of bullets */ margin: 0 20px; /* change this to increase/decrease gap between nav links */ } When it comes to the content, float your image to the right and the text to the left and style as you require. Give that a shot and report back if you run into any obstacles. Don't be discouraged, Web Design/Development is not an easy field and requires a lot of skill and dedication but if you have a passion for it then I'm sure that you won't give until you succeed Also, good work on the HTML5 Doctype and Charset! You can also remove the type="text/css" from the stylesheet link as well as it's no longer required in HTML5. Edited January 21, 201313 yr by Alluziion
January 21, 201313 yr Author I changed it and some of it works. HTML <!DOCTYPE html> <head> <title>Ask Smartphones - review phones that no or little reviews</title> <link rel="stylesheet" type="text/css" href="css/main.css"> </head> <!--begin top--> <header> <div id="menu"> <p>Ask AP</p> <li><a href="index.html">Search</a></li> <li><a href="index.html">Forums</a></li> <li><a href="index.html">Blog</a></li> </div> </header> <div class="content"> <img src="images/Icontelephone.png" alt="click here to search"> </div> <div id="body"> </div> CSS body { background-color:#3366CC; margin:10px; position: center; } #menu { height: 78px; width:990px; } #menu p { font-size:4.125em; } #menu a { text-decoration:none; padding-top:16px; font-size: } #menu li { float: right; /* floats to the right */ list-style-type: none; /* gets rid of bullets */ margin: 0 20px; /* change this to increase/decrease gap between nav links */ font-size: 2.375em; } .content { margin-top: 30px; } But when I try to have my logo and the menu have different font size, it increases each other instead of itself. If I use <p></p>, they are not aligned... Edited January 22, 201313 yr by Renaissance-Design Code formatting
January 21, 201313 yr Ok lets see... body shouldn't have a margin and position: center is not a valid property so it's not doing anything. I would take the logo out of the #menu but keep it inside the <header>... after all, it's part of the header but not the navigation. If you give your header a height then it should push your content DIV underneath like you desire. As for the font sizes, they shouldn't be increasing each other... but if you take the logo out of the #menu then you'll need to select it in your CSS as header p rather than #menu p - this may also solve your problem.
January 21, 201313 yr Author I don't understand why when I set background colour in body (in css) and it still applies even everything is not in the <body></body>
January 21, 201313 yr The <body> tag is exactly what it says it is... The body of your page. So any background style applied to it will be applied to the entire body of the page with the exception of it's children which will overlay the body.
January 22, 201313 yr Author Do you know any software that can help me get the width and height easily besides Photoshop?
January 22, 201313 yr What heights and widths are you referring to? If you just mean the various elements on your page then Photoshop should be able to do that fine... Do you have Photoshop?
January 22, 201313 yr There are a couple of basic things you need to get sorted first! Your Code <!DOCTYPE html> <head> <title>Ask Smartphones - review phones that no or little reviews</title> <link rel="stylesheet" type="text/css" href="css/main.css"> </head> <!--begin top--> <header> <div id="menu"> <p>Ask AP</p> <li><a href="index.html">Search</a></li> <li><a href="index.html">Forums</a></li> <li><a href="index.html">Blog</a></li> </div> </header> <div class="content"> <img src="images/Icontelephone.png" alt="click here to search"> </div> <div id="body"> </div> Pointers...Whoever told you to have <div id="body"> im pretty sure needs shooting! (unless ive been living in a cave)...also you have no closing <html>...also header will only work on modern browsersm which is fine if only you plan to look at it, but if other want to and have ie 8 for example, it might not work. But i believe you can use javascript to allow the browser to see it...Take a look at the code what i would use (just something else to try) <!DOCTYPE html> <!--header info--> <head> <title>Ask Smartphones - review phones that no or little reviews</title> <link rel="stylesheet" type="text/css" href="css/main.css"> </head> <!--End header info--> <body> <!--Body Opening--> <div id="wrapper"> <header> <div id="menu"> <p>Ask AP</p> <li><a href="index.html">Search</a></li> <li><a href="index.html">Forums</a></li> <li><a href="index.html">Blog</a></li> </div> </header> <div class="content"> <img src="images/Icontelephone.png" alt="click here to search"> </div> </div> </body><!--Body closing--> </html> /*css reset*/ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; } /*css reset*/ body{ /*background color or image tags go here*/ } #wrapper{ width:960px; margin:auto; border:solid 1px red; /*good practice for early building stages*/ } header{ width:100%; height:50px; border:solid 1px green; } #content{ width:100% height:500px; border:solid 1px blue; } Aslong as you follow the DOM, things should just fall into place (read up on that)...im not a fan of using float:right either...float left is always the best option for me...but thats just preference...its weird coding in a reply box so, sorry if there are any errors....And if you plan on using dreamweaver, please don't get in the habbit of using the drag and drop features....dremweaver is very good for coding, but drag and drop is just wroooong! Good luck! p.s. I don't know what happened to the code indenting...went a little weird... Edited January 22, 201313 yr by person4659
January 22, 201313 yr Author here is the link that I saw "How to Design and code a flexible website" for the divs Do I really need to reset css? because it mess up my layout... and when I use the reset.css, it makes a red box on top... Edited January 22, 201313 yr by gemichi
January 22, 201313 yr Why are you posting your code using the quote button? The code button is right next to it...
January 22, 201313 yr Author Why are you posting your code using the quote button? The code button is right next to it... Oh...I didn't notice that the unwanted boxes... Edited January 22, 201313 yr by gemichi
January 22, 201313 yr here is the link that I saw "How to Design and code a flexible website" for the divs Do I really need to reset css? because it mess up my layout... and when I use the reset.css, it makes a red box on top... How much HTML and CSS have you actually studied and learnt? Yes, you will need to use a reset as it solves most browser-incompatibility issues; the fact that your code changed so drastically when you used it demonstrates that it probably would have rendered differently in different browsers.
January 22, 201313 yr Author How much HTML and CSS have you actually studied and learnt? Yes, you will need to use a reset as it solves most browser-incompatibility issues; the fact that your code changed so drastically when you used it demonstrates that it probably would have rendered differently in different browsers. Can't really estimate. Maybe 10%? I never took any classes. Learn it all by myself. Edited January 22, 201313 yr by gemichi
January 22, 201313 yr I would try studying a bit more before attempting to make a website. You need to understand how block elements are displayed as well as understanding the DOM (Document Object Model). Web Development/Design is not an easy profession that can be learnt overnight, just keep studying and practicing. If you can post your current code, I will take a look and see if I can identify what's causing those boxes. Also, are you coding it from scratch or using a "Drag-and-drop" feature provided by an IDE or similar software?
January 22, 201313 yr Author HTML <!DOCTYPE html> <head> <title>Ask Smartphones - review phones that no or little reviews</title> <link rel="stylesheet" type="text/css" href="css/reset.css"> <link rel="stylesheet" type="text/css" href="css/style.css"> </head> <!--begin top--> <body> <div id="wrapper"> <header> <div id="menu"> <p>Ask AP</p> <li><a href="blog.html">Blog</a></li> <li><a href="forums.html">Forums</a></li> <li><a href="index.html">Search</a></li> </div> </header> <div id=container class="content"> <img src="images/Icontelephone.png" alt="click here to search"> </div> </div> </body> </html> CSS #wrapper { width:990px; } body { background-color:#fff; } #menu { height: 78px; width:990px; } #menu p { font-size:4.125em; float:left; margin: 0 20px; color: #000000; } #menu a { text-decoration:none; color: #000000; padding-top:16px; } #menu li { float: right; /* floats to the right */ list-style-type: none; /* gets rid of bullets */ margin: 0 20px; /* change this to increase/decrease gap between nav links */ margin-top: 20px; font-size: 2.375em; } #container { width: 990px; border-top: 15px solid #000000; padding: 10px; } #container img { float:right; padding:30px; } .content { margin-top: 30px; }
Create an account or sign in to comment