Web design from template - html

I'm new to web designing.
I started to designing a sample page but I have some challenges.
I have photoshop template like below image.
to convert it to HTML and CSS I fallowed these steps :
I separated background image with logo then I putted to background of body
I created main DIV as page container with relative position.
now I want to put texts to page ( OH BOY WE'RE LOST !) and ( THE RESOURCE YOU ARE LOOKING FOR MIGHT HAVE BEEN REMOVED, HAD ITS NAME CHANGED OR
TEMPORARILY UNAVAILABLE.)
I have some questions here :
How do I put them on Page ? both of them in one DIV ? or each one in separated DIV ?
How should I position them to having same position in picture and web site ? is there any specific technique exist ? or should I do i with test and try ?
Please explain me.

Fix the width width:100% of the page div. and give <h1> tag for "OH BOY WE'RE LOST!" with specified width and margin: 0 auto;.
and <p> tag for remaining text that "HE RESOURCE YOU ARE LOOKING FOR MIGHT HAVE BEEN REMOVED, HAD ITS NAME CHANGED OR TEMPORARILY UNAVAILABLE."
<div class="page">
<h1>OH BOY WE'RE LOST!</h1>
<p>HE RESOURCE YOU ARE LOOKING FOR MIGHT HAVE BEEN REMOVED, HAD ITS NAME CHANGED OR TEMPORARILY UNAVAILABLE.</p>
</div>
css :
.page {
position:relative;
width:100%;
height:auto;
}
.page h1 {
position:absolute;
top:0px;
left:0px;
font-size: /*your font size*/
font-family: /*your font family*/
width:100px; /*you can change the width as per your need*/
margin:0 auto;
}
.page p {
width:98%;
margin:0 auto;
}

How do I put them on Page ? both of them in one DIV ? or each one in separated DIV ?
Both of them in seperate div and enclosing them in the background image div. I personally prefer span than div because it is plain text.
<div class="backGroundImag">
<span class="text1"> Text goes here </span>
<span class="text2"> Text goes here </span>
</div>

You need to keep in mind the web is not a pixel perfect medium as there are so many variables in play: different browsers, operating systems, screen resolutions etc.
If you are new to web designing, start with something a little more simple. What you have there is a great design that may not immediately translate easily to the web (your search box for a start would provide some interesting implementation challenges).
Don't aim too high early on. Read, practice, repeat. Here is a good article on centered design techniques to get you started:
http://www.webdesignforidiots.net/2009/03/fixed-width-centered-website/
Marked as CW because this is advice and not an answer!

body { margin:0px; padding:0px; font-family:Arial, Helvetica, sans-serif; }
.wrapper { width:600px; margin:0px auto; background:url(images/bg.jpg) no-repeat; min-height:437px; }
.header { width:144px; margin:0px auto; padding: 25px 0 20px 0; height:130px; } /*If you want logo Seperatly use this step*/
.header h1 { margin:0px; padding:0px; } /*For Seo prupose*/
.content { margin:0px auto; padding:0px; width:480px; }
.content h1 { text-align:center; text-transform:uppercase; font-size:16px; margin:0px; padding:0px;}
.content h2 { font-size:12px; }
HTML
<div class="wrapper">
<div class="header"><h1><!--<img src="images/logo.png" alt="logo" />-->Logo</h1></div>
<div class="content">
<h1>OH BOY WE'RE LOST !</h1>
<h2>THE RESOURCE YOU ARE LOOKING FOR MIGHT HAVE BEEN REMOVED, HAD ITS NAME CHANGED OR TEMPORARILY UNAVAILABLE.</h2>
</div>
</div>

Related

How to get picture to align with the left set of paragraphs/go to right of?

Here is a prototype of what I am trying to implement
Here is what I currently have : JsFiddle
I am trying to get the picture of the guy on the laptop to align correctly with and to the right of the paragraph components - Business Traveller, Office Supply Purchases, etc...
What I've tried is using Align attribute, changing my img src code to
<img id="laptop" align="middle" src="zoom-39988392-3.JPG" height = "90" width ="90" />
but that didn't have any effect.
I also tried Float but that messed up my margins and the organization of my left components.
Is there a way I can do this without floating?
See the fiddle
The HTML and CSS that i've used is as follows. Used float:left
HTML
<div class="container">
<div id="choices">
<p class="choice">Business Traveller</p>
<p class="choice">Office Supply Purchases</p>
<p class="choice">Stay at home parent</p>
<p class="choice">Entertainment</p>
<p class="choice">Profile 6</p>
</div>
<div class="image"></div>
</div>
CSS
html, body, .container {
height:100%;
}
#choices {
width:30%;
float:left;
}
.choice {
margin-top:0px;
margin-left:20px;
text-align:center;
width:100%;
background-image: url("http://i.imgur.com/H43sVoi.png");
padding-top:15px;
padding-bottom:15px;
}
.image {
height:100%;
width:65%;
background-color:red;
float:left;
}
You will have to work with the height and width of each divs. I just made it roughly.
You have to create two columns. 1 column for the menu and the second column for the image. If you do this, you wont have trouble floating.

Why is my 'clickable' <img> covered (and therefore not clickable)? And by what is it covered?

So, I had a difficult time trying to figure out why a couple of my links were not clickable. I finally figured out that they just needed a 'higher' z-index. I don't really understand why they needed that in order to work though. I'm figuring out (through google-research) that some elements can be 'covered' by other elements. I don't understand how that happened in my code, in particular, and kind of still confused about that whole concept of some elements 'covering' others. Can anyone explain? Here's the relevant HTML and CSS, respectively: (I had trouble with the elements within )
HTML:
<section id="nav_images">
<img id="skull" class="reflectBelow" src="ScumSkull.jpg" alt="Click for scoop" height="94" width="94"/>
<img id="staff" class="reflectBelow" src="ScumStaff.jpg" alt="Click for staff" height="94" width="94">
<img id="bulbs" class="reflectBelow" src="ScumBulbs.jpg" alt="Click for sermons" height="94" width="94">
</section>
<aside id="don8">
<p id="don_P">Make a Donation to Scum</p>
<img id="donate" src="donate.gif" alt="Donate button" height="47" width="147">
</aside>
<aside id="slogans">
<h3>Top Five Rejected Scum of the Earth Slogans</h3>
<p id="slogan_5" class="slogan">5. Emerging from the emergent church</p>
<p class="slogan">4. Our congregation can kick your congregation's ass</p>
<p class="slogan">3. Same old evangelical crap, different package</p>
<p class="slogan">2. Come to see the crazy bathrooms, stay for a sermon</p>
<p class="slogan">1. And you thought mega-churches sucked</p>
</aside>
CSS:
body
{
background-color:#000000;
margin:0;
padding:0;
font-size:100%;
width:100%;
}
main
{
display:block;
max-width:700px;
margin:40px auto 300px auto;
height:650px;
}
img
{
padding:0;
margin:0;
border:none;
float:left; /* Gets rid of space between images */
}
#don8
{
clear:left;
float:right;
position:relative;
top:50px;
width:250px;
height:140px;
border-left:13px solid red;
}
#don_P
{
width: 60px;
position:relative;
top:-10px;
left:60px;
text-align:center;
z-index:2;
}
#don_P a:link, a:hover, a:focus
{
text-decoration:none;
color:white;
}
#donate
{
position:relative;
top:-10px;
left:20px;
z-index:2;
}
#slogans
{
clear:left;
position:relative;
top:50px;
left:35px;
/* border-right: 5px solid red; */
}
.slogan
{
margin-top:0;
margin-bottom:0;
line-height:160%;
}
#slogan_5
{
margin-top:10px;
}
Unless I'm missing some CSS, your links are not covered. Their color turn white on :hover.
#don_P a:link, a:hover, a:focus { color: white; }
The following link shows a nice picture of what it looks like when the 'layer' is visible and overlapping another layer. This 'overlapping' will happen primarily when you force how the browser should render an item by specifying the coordinates where the item should be placed on the page.
http://www.w3.org/wiki/CSS/Properties/z-index
A convenient way to observe how the browser has layered your HTML, you can use Google Chrome developer tools. Open the page in Google Chrome browser, then Right click on the element in question and select "Inspect Element". This will give you a view of the boundaries of that element.
Pretty much all modern browsers have this 'element inspector' feature somewhere. Firefox also has this feature in their dev tools, but also has a fancy tool that can also do this, but in 3D:
https://developer.mozilla.org/en-US/docs/Tools/3D_View
I looked over your code and I see the overlap.
Your problem is that this:
<aside id="slogans">
<h3>Top Five Rejected Scum of the Earth Slogans</h3>
<p id="slogan_5" class="slogan">5. Emerging from the emergent church</p>
<p class="slogan">4. Our congregation can kick your congregation's ass</p>
<p class="slogan">3. Same old evangelical crap, different package</p>
<p class="slogan">2. Come to see the crazy bathrooms, stay for a sermon</p>
<p class="slogan">1. And you thought mega-churches sucked</p>
</aside>
is appearing on top of
<aside id="don8">
<p id="don_P">Make a Donation to Scum</p>
<img id="donate" src="donate.gif" alt="Donate button" height="47" width="147">
</aside>
Here is an analogy. Imagine if you have two sheets of paper stacked on top of each other. When you bring your pen down on them, it only touches the top one.
This is the same for your mouse pointer. When you click on the page, you click on the top element. In your case, the top element isn't the link so you can't click on it.
There are two solutions to this problem.
Limit the width the the overlapping object so it no longer overlaps.
Give your elements z-indexes and position the link on top.
If you are unclear how z-indexes work here is a good link:
http://www.smashingmagazine.com/2009/09/15/the-z-index-css-property-a-comprehensive-look/
To put it simply, elements with a higher z-index are positioned above elements with lower one. If there is no z-index, the browser just decides.

Getting <DIV>'s to vertically hug text contents

I'm attempting to get a div element to hug the contents as tightly as possible. This works fine for the width by using display:inline-block, but the height always has some extra padding/ margin/ border. How do I get the parent div to wrap the text exactly? I can get it by judicially choosing line-height, but this only works for a particular font and size.
How do I get the red box below to wrap the text as close as possible... for any input font or size?
Example:
jsfiddle, with css code
.outer {
display:block;
background:red;
}
.hug {
font-size:200%;
margin:0em;
border:0em;
padding:0em;
}
and html:
<div class="outer">
<div class="hug">
<h1>PERFECT FIT</h1>
</div>
</div>
<div class="outer">
<div class="hug">
<h2>PERFECT FIT</h2>
</div>
</div>
CSS, CCS3 solutions preferred over javascript, unless it isn't possible.
I ended up getting some decent results with this. If you alter the font size the line-height can stay as needed and hugs pretty darn close... Does it need to be to the pixel exactly?
.thisone{
display:inline-block;
background:#09f;
min-width:1px;
font-family:arial;
width:auto;
font-size:70px;
line-height:.70em;
}
DEMO
Here is something I've tried : http://jsfiddle.net/wared/CpZru/. My first attempt (pink) worked only with H2, so, I gave a closer look to this tag's default styles, and noticed that the font size was set to 1.5 (Chrome). Then I used this ratio for my second attempt (blue) : 1 / 1.5 = 0.666.... Although the result is more reliable, the ratio seems not to be valid with a different font weight (1 pixel overflows the P tag's line) or a different font family (green test).
You could calculate the ratio for each font weight/family since both parameters seem to affect the line height ratio. I'm not able to get something more interesting currently. Hope it can help in some way.
<div class="em1">
<h1>PERFECT FIT</h1>
<h2>PERFECT FIT</h2>
<p>PERFECT FIT</p>
</div>
<div class="em67">
<h1>PERFECT FIT</h1>
<h2>PERFECT FIT</h2>
<p>PERFECT FIT</p>
</div>
<div class="em67 arial">
<h1>PERFECT FIT</h1>
<h2>PERFECT FIT</h2>
<p>PERFECT FIT</p>
</div>
.em1 {
line-height: 1em;
}
.em1 * {
background: pink;
line-height: inherit;
}
.em67 * {
background: lightblue;
line-height: .67em;
}
.arial * {
font-family: Arial;
background: lightgreen;
}
.outer {
display:block;
background:red;
float:left;
clear:both;
}
.hug {
font-size:200%;
margin:0em;
border:0em;
padding:0em;
}
.hug h1,
.hug h2 {
margin:0;
padding:0;
height:1em;
line-height:1em;
}

Styling problems using CSS

http://jsfiddle.net/AmKHx/
Hello all,
I linked my code on the top. My main problem is that I have my header, content and footer perfectly set that works with all websites. It does not have a scrolling feature or anything. Everytime I try to add the Intel Logo to the screen. It does what it is up there. I move it around and tweek it and then it works for one browser and not the other... It keeps changing. I want the logo to stick to the left perfectly along with the header I made with CSS. Also I want the Mobility Group Text at that height right next to the logo, but for some reason it always messes up my header content and footer as well when I paly with it. So pretty much I want The Logo on first then Mobility Group Right next to itand make it very smooth!
Also I have just learned html css and php and if you guys see something in my code that could be done smarter please let me know. I need critical feedback so that I can progress in learning these new languages better so that I can succeed in this field of programming!
Thank you in advance for all the input and advice!!
HTML CODE:
<div id="page">
<div id="header">
<h1><img src="http://wireless.fm.intel.com/test/logo2.png">
<h2>Mobility Group</h2>
</div>
<div id="main"></div>
<div id="footer"></div>
</div>
</body>
CSS CODE:
Html, body
{
Padding:0;
Margin:0;
Height:100%;
}
#page
{
Min-height:100%;
position:relative;
height:100%;
}
#header
{
background-color:#115EA2;
height:100px;
width:97.5;
}
#main
{
width:1300px;
margin-left:auto;
margin-right:auto;
background-color:#F1F2F3;
min-height:87%;
height:auto;
height:87%;
margin:0 auto -50px;
vertical-align:bottom;
}
#footer
{
Position:fixed;
Width:100%;
Bottom:0;
Height:50px;
background-color: #115EA2;
}
#header h1
{
position:absolute;
text-align:left;
left:0px;
top:0px;
}
#header h2
{
text-align:center;
font-size:44px;
color:#FFFFFF;
left:0px;
top:20px;
font-weight:bold;
}
I'm still not sure I understood the question, but here's what can you do to make it more natural looking. Close the h1 tag, don't make it absolutely positioned, but rather make it float left. The same thing goes to the h2 element. And since the original image is missing, I've put another one, and fixed its height to 60px.
It's basically this:
#header h1 {
text-align:left;
left:0px;
top:0px;
float: left;
}
#header h1 img {
height: 60px;
}
#header h2 {
text-align:center;
font-size:44px;
color:#FFFFFF;
left:0px;
top:20px;
font-weight:bold;
float:left;
}
See the results here: http://jsfiddle.net/AmKHx/1/ It should look the same in every modern browser.
Also, try not to use capital letters for CSS attributes - it's a standard to use lower case, and even some browsers might not like it.
Do you have a reset sheet?
Copy this to a new css file, call it reset.css and then load it in your page before you load your main css.
html{color:#000;background:#FFF}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0}
table{border-collapse:collapse;border-spacing:0}
fieldset,img{border:0}
address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal}
ol,ul{list-style:none}
caption,th{text-align:left}
h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}
q:before,q:after{content:''}
abbr,acronym{border:0;font-variant:normal}
sup{vertical-align:text-top}
sub{vertical-align:text-bottom}
input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit}
input,textarea,select{*font-size:100%}
legend{color:#000}

Wrapper layout and div problems

Image
I tried this with the following CSS and HTML. It looks fine when the browser is of full width and scrambled when browser is resized. I WANT the elements to be where there and a HORIZONTAL SCROLL has to appear when the BROWSER is RESIZED. Pretty new to web programming. Text-align:center for positioning the center column would not work because, every time a new text is added in the left or right, it gets relocated and also center column element in ROW1(text) and ROW2(Button) do not appear along the same line. That is, text appears a bit right and the button a bit left. Text-align won't work here.
CSS:
#charset "utf-8";
/* CSS Document */
body
{
background-color:#000;
}
.wrapper
{
width:70%;
margin:0 auto;
padding:2px;
background-color:#fff;
}
.second_row
{
padding:2px;
margin-top:10px;
}
.center_container
{
width:30%;
margin:0 auto;
}
.left_container
{
width:33%;
float:left;
}
.right_container
{
width:33%;
float:right;
}
.topelements
{
margin-top:0px;
color:#777;
padding:2px;
}
.topelements a:link
{
color:#29a3cc;
}
.topelements a:active a:hover
{
color:#29a3cc;
}
.logo
{
overflow:hidden;
}
HTML code:
<div class="wrapper">
<span class="topelements float_left" >Mail us: admin#admin.com</span>
<span class="topelements float_right">Left links My xyz</span>
<span class="topelements center_container">Welcome to xyz ! Sign in or Signup.</span>
</div>
<div class="wrapper second_row">
<span class="left_container">Srini</span>
<span class="right_container">Vas</span>
<form class="center_container">
<input type="text" placeholder="Goooooooooooo!" />
<input type="submit" value="Search" />
</form>
</div>
<div class="wrapper">
If you want to align you object in the center, there are a couple of different ways. First of all, there is the text-align:center; which you don't need right now. There is also object-position:center; which basically does the same, but with an object. This way isn't the best, but you could add a certain percentage of padding to either side but that's not recommended. Lastly, there's alignment-adjust:central;. This may not be perfect for your situation but just try out all of these and see if they work. Good luck!
One way that would work is to set your wrapper width to a fixed value (something in 800px for example). As long as this width was longer than all the content you are putting within that wrapper, everything should work as you want. The browser will automatically place a horizontal scroll bar when the window gets smaller than the width of the wrapper.
This is just a small error I found in the CSS and I don't know if this will help too much. The div you added was not referred to as a div, but a class. For example, if you wanted to style a div in CSS, you would do this:
#divname {
CSS for div goes here...
}
On the other hand, if you wanted to add a little style to a class, you would go like this:
.classname {
CSS for class goes here...
}
If you were wondering what the difference for each is, the answer is simple. A class can define multiple objects while the divs are just limited to one object or element.