Can't seem to put multiple properties in one <div>


#1

So, I'm making a webpage for myself and I put a

in there. I'm trying to make the Div aligned center and make it 384px by 16px at the same time. Here's my code:
<div align="center" style="width:384px; height:16px">
    <a background-color=#FF0000 href="http://tempestwizard.altervista.org/Easier_Videos.html">If this page takes very long to load, click here</a>
    </div>

unfortunately, it does not let me put both the style and align on there, if i just put the align, it will align itself, but once i put the style on, the align automatically goes away. i've tried to put "align=center" into the style thing, but it won't work. also, i put a semicolon between and it still doesn't work. what do you have to do to put multiple properties in one tag?


#2

Would it be easier to just make your code:

<div> 
<a href"http://tempestwizard.altervista.org/Easier_Videos.html">If this page takes very long to load, click here
</a> 
<div>

And then on a style sheet, place a
div {
align="center";
width:384px;
height:16px"
}


#3

i also have other divs in the same html page, so how do i do that without applying the align to the other divs?


#4

you can multiple style property's + values in one html tag, like so:

<div style="width:384px; height:16px; text-align: center; background: red">

i also took the liberty of adding a background-color, so i could see where the div is. i believe align="center" is Deprecated. If you want to centralize the text in the block use text-align: center; if you want to centralize the div itself, use: margin: 0 auto;

you can also give the div an id, and then use pound/number sign in css to target a specific div. html code:

<div id="button"></div>

css code:

#button {
  width:384px; 
  height:16px; 
  text-align: center; 
  background: red
}

@jackrakansan, align: center is Deprecated, and you use a equal sign after align, you should use a colon


#5

thank you this helped a lot