Welcome Guest, please login or register.
Username:
Password:

News: Welcome to Hostpapa Forums!
Pages: [1]   Go Down
Topic Tools  
Read
December 07, 2010, 04:25:48 PM
sejmno
Newbie
*
Posts: 6



I've made a CSS and a HTML file, and i linked them together, as a stylesheet. But i don't remember how to set margins? Is it in the CSS or HTML file i set them? And what code? Thanks :-)
Logged
 

Read
December 08, 2010, 01:05:02 PM
HelpingHand
Full Member
***
Posts: 117



You set the margins in the CSS file for the <div> in question. If the div is named 'wrapper', for example ( <div id="wrapper"> ) you would enter this into the CSS:

#wrapper {
margin: 15px 0 0 15px;
}

remember the order when entering the values is Top, Right, Bottom, Left.

You can also just use 2 values if the top/bottom, and left/right are the same:

#wrapper {
margin: 15px 10px;
}

This will set the top & bottom to 15px and the left and right to 10px.

You can also set values for each position individually:

#wrapper {
margin-top: 15px;
}

Don't forget the ; at the end of the values. All CSS codes can be found here, http://w3schools.com/css/default.asp.

Logged
 

Read
December 08, 2010, 03:01:49 PM
sejmno
Newbie
*
Posts: 6



Thanks alot for your help :-). But isnt that only for 1 file at the time? I want to set up margins for the whole website?
I wrote:

{Left-margin: 65px;
Right-margin: 65px;}

In the CSS file. Is that wrong if i want to set up margins for the Whole page?


Logged
 

Read
December 08, 2010, 03:10:47 PM
HelpingHand
Full Member
***
Posts: 117



Your syntax isn't right. It's not left-margin:, it's margin-left:

If you want to apply it to the whole page you have to set it in the body:

body {
margin: 0 65px;
}

This will set the left and right margins to 65px
Logged
 

Read
December 08, 2010, 03:20:23 PM
sejmno
Newbie
*
Posts: 6



Oh. Thanks alot for your time! But just 1 more question :-). When i've set the left&right margins to for example 65. If i then want to set in a picture, how do i set it's margins to like 35?

Is it just like:

.img1
{
margin-left: 35px;
margin-right: 35px;
}

Logged
 

Read
December 08, 2010, 03:26:43 PM
HelpingHand
Full Member
***
Posts: 117



That is correct. Just make sure to assign your class 'img1' to the div or table containing the image.
Logged
 

Read
December 08, 2010, 03:28:41 PM
sejmno
Newbie
*
Posts: 6



Yes ofcourse. Again thanks for your help!
Logged
 

Read
December 08, 2010, 03:36:13 PM
HelpingHand
Full Member
***
Posts: 117



Any time.
Logged
 

Read
December 08, 2010, 07:12:03 PM
sejmno
Newbie
*
Posts: 6



Another question :-D. When im working in DW, and i click "Design" on the HTML doc, everything looks fine. And then when i save my CSS and HTML file, and launch it in Google Chrome or Internet Explorer, my font-type aint working the way it should? Neither in the menu, or in the text? But it is in Dreamweaver. This is my css and html file:

.vlink
   {
   color:#ffffff;
   background-color:#006;
   font:counter;   
   }

<a href="forside.html" class="vlink" style="padding:4px 14px 4px 14px">Forside[/url]

And then ofc i have more buttons in the menu.. But can you/someone tell me why i dont see the right type of font? And i ofcourse also linked the HTML to the CSS:
<link href="forside.css" rel="stylesheet" type="text/css" />
« Last Edit: December 08, 2010, 07:13:17 PM by sejmno » Logged
 

Read
December 08, 2010, 07:24:35 PM
HelpingHand
Full Member
***
Posts: 117



Have you specified a font family in your css? If you don't the browser will use the default font it is set to. You can set this in the body as well:

body {
font-family: Arial; (or whatever font it is you are using)
}
Logged
 

Read
December 09, 2010, 11:03:39 AM
sejmno
Newbie
*
Posts: 6



No i didn't, and it's working perfect now. I didn't think that the font-family was so important.. But apparently it was ;-). You're a great help dude :-)
Logged
 

Pages: [1]   Go Up
Jump to:  

Theme by webtechnica.net