More CSS questions

deadfingersdeadfingers Senior MemberThe Royal RAM
Alright well ive been looking on HTML goodies and i know u need to have like H1-like H6 and stuff but are each one specific to certain codes? like is H1 just for font codes, and H3 for like color coding and stuff? would i be able to do this
H3{font-family:arial;font-color:red;margin-right:auto;margin-left:auto;}
or
H4{font-family:arial;font-color:red;margin-right:auto;margin-left:auto;}
or
H1{font-family:arial;font-color:red;margin-right:auto;margin-left:auto;}

so if i use any of these in the like <h1> or <h3> or <h4> they would all work equally? Im not sure if they are specific to each thing but im guessing they arent, also can u use spacing codes in those? like how i have the margin ones? or do i do it for each thing i want spaced out. thanx
sig.jpg

Comments

  • tonytony Moderator Administrator
    no H1 is like a really important header, H2 is a slightly less important header and so on down to 6 decreasing in importance everytime.

    So for instance say you were writing an essay H1 would be the main header, H2 would be the title or each of the sections such as introduction conclussion etc I dont really think there is much use for anything below H1 and 2
  • deadfingersdeadfingers Senior Member The Royal RAM
    ok so but you can use either one and it would still work then right? i tried it last night and i used the same codes with H1-H6 and it worked so thats good, so its just for importance? what does the "importance" matter if you can use any of them? im not being stupid i really want to know lol Also something i noticed when i had <link rel=stylesheet href=style.css type=text/css> is that when i put in the code margin-left:auto; margin-right:auto; in the page style.css it doesnt do anything to my main page. Why? i put in actual px and it works, margin-auto only seems to work at different times for me, where exactly do you use it then?
    sig.jpg
  • CannonBallGuyCannonBallGuy Moderator Shared Hoster
    If you use the default H1-H6 then they get smaller...
    So you could do the same thing in your Style Sheet.
    As for the Margin, I pass.
  • tonytony Moderator Administrator
    as cbg said if you use the default they get smaller from 1 being the biggest
    but also theres strong belief that if you put your headers in H1 tags or any of the other H tags it counts those words more important so they can be used for optimising your site to a small degree,
    as for the rest i dont undrstand the question but im fairly new to css anyway so that might be why
  • deadfingersdeadfingers Senior Member The Royal RAM
    well alright, i made a style.css page so that i can use that one page for all the others, u know using the <link rel=stylesheet href=style.css type=text/css> which is used to "link to that page so you can use all the settings in that page your linking to. I hope that makes sense, anyways in that one page that has all my CSS coding to use on the other pages i put in margin-left(or right):auto; which is supposed to automatically center it in the middle, but i put this and it doesnt do anything. I use margin-left:300px; and it works.
    sig.jpg
  • TheDonkeyTheDonkey Junior Member Shared Hoster
    CSS is just a style definition file/code....so its not moddifying the html code H1-H6 all css is doing is changing the way a browser will render the other wise normal html code.....so that H1 is still H1 wether or not CSS is involved....

    what Im trying to say is CSS just tells the browser how to make things appear on the end users screen....

    Am I making sense?
    Capt. D
    F18_468x60.jpg
  • strangedarstrangedar Senior Member The Royal RAM
    If you want to center an element like a heading you just use

    text-align: center;

    if you want to center the page you need to do:
    #wrapper {
    position: relative;
    margin-left: auto;
    margin-right: auto;
    padding-left: auto;
    padding-right: auto;
    }
    body {
    text-align: center;
    }
    #content {
    text-align: left;
    }
    strangedarknesssig.jpg
    sebastianastill.co.uk - My Portfolio
  • TheDonkeyTheDonkey Junior Member Shared Hoster
    or you could just wrap your whole page in a div

    example

    <body>
    <div align="center">
    <table>
    <!-- your sites html -->
    </table>
    </div>
    </body>

    this is obviously simplified but I think you get the idea ;)
    Capt. D
    F18_468x60.jpg
  • PythonPython Forum Leader The Royal RAM
    Yes but then that wouldnt be using CSS would it :)
    But yes that method would also work.

    The Royal Ram

  • TheDonkeyTheDonkey Junior Member Shared Hoster
    ok so then give the div an id and in the CSS file just make it align center....hehehehe ;)
    Capt. D
    F18_468x60.jpg
  • deadfingersdeadfingers Senior Member The Royal RAM
    TheDonkey wrote:
    ok so then give the div an id and in the CSS file just make it align center....hehehehe ;)
    Lol yeah you could do that as well but more work just to say "its CSS" lol
    sig.jpg
  • CannonBallGuyCannonBallGuy Moderator Shared Hoster
    IIRC, the align attribute is depreciated.
  • deadfingersdeadfingers Senior Member The Royal RAM
    whats IIRC? Kinda sucks some of the HTML I know is getting depreciated little by little oh well at least Im learning CSS as well.
    sig.jpg
  • TheDonkeyTheDonkey Junior Member Shared Hoster
    I belive he means "If I Recall Correctly" and yes the are depreciated...its to bad they are getting rid of the simple parts of HTML...I mean really what is wrong with "align"

    I mean seriously take a look at this http://www.w3.org/TR/html401/present/graphics.html#adef-align
    they are taking away something that is simple and easy and making it time consuming and complex........
    Capt. D
    F18_468x60.jpg
  • strangedarstrangedar Senior Member The Royal RAM
    Its for accessibility. HTML was never meant for presentation so now its been fixed. :D
    strangedarknesssig.jpg
    sebastianastill.co.uk - My Portfolio
  • TheDonkeyTheDonkey Junior Member Shared Hoster
    what are you talking about?

    accesibility your trying to tell me a few words versus a few lines of code makes it more accesible, that align (used in every other profession, think about it you get your car aligned) is an accesibility issue........

    Im not against CSS or anything Im just saying removing something simple and replacing it with something more complex when the simple worked fine is just retarded.....

    I mean people know align, float yeah thats something you do in WATER....hehehe im mostly just kidding here people, so take this with a grain of salt. however I hope you see what I'm saying.....
    Capt. D
    F18_468x60.jpg
  • pfgannonpfgannon Moderator Administrator
    But align is a "hack of html" and was never meant to be used. Using CSS instead is more accessible because all browsers render it properly and all future browsers will render it properly..
  • TheDonkeyTheDonkey Junior Member Shared Hoster
    Sure they will ;) hehehe
    Capt. D
    F18_468x60.jpg
Sign In or Register to comment.