PDA

View Full Version : Am I missing some thing?



James Jobs
Jan 25th, 2009, 10:53 PM
When I want to make a box with CSS I call the style .box and it will not show up unless I Style some text as .box is there a way to make a box without adding text?
Sorry if this is obvious, but this is puzzling me.

effpeetee
Jan 25th, 2009, 10:58 PM
When I want to make a box with CSS I call the style .box and it will not show up unless I Style some text as .box is there a way to make a box without adding text?
Sorry if this is obvious, but this is puzzling me.


Unless you put text in the box or an image or fill the box with colour or give it a border; you will not see it. It will be where you put it but have no no visual effect unless added.

It will still take up space according to the parameters that you set.

A look at your code would help!
We cannot read minds yet!

Frank

James Jobs
Jan 25th, 2009, 11:15 PM
Here is the code
.grad-up {
background: url(gradup.png) repeat-x;
width: 100%;
display: inline;
position: fixed;
top: 198px;
left: 0px;
}

bazz
Jan 25th, 2009, 11:40 PM
Firstly, welcome to CF.

Now for that css...

you should have something in your css, perhaps a <p> tag or a <div> which has a class assigned to it. the class should be named the same as in the css.



<div class="grad-up">&nbsp;</div>

&nbsp; is a 'non-break space'

a few tips:

1. make sure you add padding:0;border:0;margin:0; at the start of your css file like this



* {
padding:0;
border:0;
margin:0;
}


This will force all browsers to read those values the same way and not to use default values, which are different from browser to browser.

2. I can't recall whether it is my personal choice or a best practice thing but, it is better to use grad_up instead of grad-up.

3. in case you ruin into issues later, you can tie an html elemetn to the css either by a 'id' or a 'class' An id can be used only once per page but classes can be used repeatedly. prefix the css like you have done for a class - with a dot - and for an id, use a #

hth

bazz

James Jobs
Jan 26th, 2009, 12:06 AM
Thank you all so much and making my first question a good one.

James Jobs