Html 5 and CSS

Discussion in 'Tech Discussion' started by ElTorroLoco, Jun 26, 2017.

Tags:
  1. ElTorroLoco

    ElTorroLoco [Christmas spiritbun][Left Hand of Sordahon]

    Joined:
    Apr 11, 2016
    Messages:
    1,008
    Likes Received:
    702
    Reading List:
    Link
    So I've started trying to learn to code the last couple of days but I keep trying something and I can't really get it to work. I tried a quick google search and I could not really find the problem.
    so if you have <p style="font-family: calibri;">random text</p> how would you add in a second style?
    I have tried doing <p style="font-family: calibri;", style="text-align: center;">random text</p> and <p style="font-family: calibri;" style="text-align: center;" but, both did not work for me. Could any of you help me with this?

    And major props to people that can make good looking sites from sites all I've made till now are pretty bad, haven't really started exploring CSS
     
  2. RizYun

    RizYun #Kaffee4Laifu

    Joined:
    Apr 29, 2016
    Messages:
    1,980
    Likes Received:
    2,136
    Reading List:
    Link
    *white flag is rising*
     
    Last edited: Jun 26, 2017
  3. Indiboy

    Indiboy Well Known boi

    Joined:
    Jan 11, 2016
    Messages:
    1,813
    Likes Received:
    2,039
    Reading List:
    Link
    Watch a proper tutorial
     
  4. Frixx

    Frixx Active Handsome Member

    Joined:
    Apr 4, 2017
    Messages:
    623
    Likes Received:
    571
    Reading List:
    Link
    Oh, is programming really hard? because in college i'll be choosing this course... i don't really know much about it. Enlighten me.
     
  5. Reaper1710

    Reaper1710 Greatest mass murderer (Undead)

    Joined:
    Apr 20, 2016
    Messages:
    157
    Likes Received:
    117
    Reading List:
    Link
    Do you want different font in same paragraph?
     
  6. ElectricIcecream

    ElectricIcecream Well-Known Member

    Joined:
    Oct 20, 2015
    Messages:
    49
    Likes Received:
    39
    Reading List:
    Link
    Try making a separate CSS document where you can change fonts, colors, alignment and more in one. Example:
    HTML:
    #classname{
        padding:auto;
        height:auto;
        width:20%;
        border:inset;
        text-align:center;
        font-size:24px;
        background-color:#000;
        cursor:pointer;
    }
     
    ElTorroLoco likes this.
  7. TUSF

    TUSF Well-Known Member

    Joined:
    Oct 20, 2015
    Messages:
    323
    Likes Received:
    236
    Reading List:
    Link
    the `style` parameter is basically an in-line CSS rule. You can actually add any number of options inside of it without issue, so something like this is fine:
    Code:
    <p style="font-family: calibri; text-align: center;">random text</p>
    Or even
    Code:
    <p style="
        font-family: calibri;
        /* A comment! */
        text-align: center;
    ">random text</p>
    Both would give the same result.

    Basically, just split each "rule" with a semicolon.
     
    ElTorroLoco, Tianshen and fuzor100 like this.
  8. Guess Who

    Guess Who Well-Known Member

    Joined:
    Mar 13, 2016
    Messages:
    100
    Likes Received:
    65
    Reading List:
    Link
    Try putting this on the <head> part
    <style>
    p{font-family: calibri; text-align: center;}
    </style>
    P.S: its been a while so not sure if this is correct xP
     
  9. prav92

    prav92 ZeusKing

    Joined:
    Sep 27, 2016
    Messages:
    330
    Likes Received:
    221
    Reading List:
    Link
    <p style="font-family: calibri;text-align: centre; ">random text</p>
    I used this site at the beginning
    https://www.w3schools.com/css/
     
  10. fuzor100

    fuzor100 Standby mode...

    Joined:
    Mar 14, 2016
    Messages:
    2,096
    Likes Received:
    5,158
    Reading List:
    Link
    it's better if you start learning css for this styling. You will be using the css more in the future anyway.
     
    ElTorroLoco likes this.
  11. I Eat Monsanto

    I Eat Monsanto He who courts death

    Joined:
    Nov 23, 2016
    Messages:
    2,273
    Likes Received:
    2,384
    Reading List:
    Link
    <p style="font-family: calibri; text-align: center;">random text</p>
     
  12. ElTorroLoco

    ElTorroLoco [Christmas spiritbun][Left Hand of Sordahon]

    Joined:
    Apr 11, 2016
    Messages:
    1,008
    Likes Received:
    702
    Reading List:
    Link
    Oh thanks
    mmh didnt know that.
     
  13. ElTorroLoco

    ElTorroLoco [Christmas spiritbun][Left Hand of Sordahon]

    Joined:
    Apr 11, 2016
    Messages:
    1,008
    Likes Received:
    702
    Reading List:
    Link
    Thanks
     
  14. ElTorroLoco

    ElTorroLoco [Christmas spiritbun][Left Hand of Sordahon]

    Joined:
    Apr 11, 2016
    Messages:
    1,008
    Likes Received:
    702
    Reading List:
    Link
    I am but im trying to first leran the basics of html and after that css.
     
  15. ElTorroLoco

    ElTorroLoco [Christmas spiritbun][Left Hand of Sordahon]

    Joined:
    Apr 11, 2016
    Messages:
    1,008
    Likes Received:
    702
    Reading List:
    Link
    Yeah im still trying to learn css im probably going to start with html basics and after that css.
     
  16. ElTorroLoco

    ElTorroLoco [Christmas spiritbun][Left Hand of Sordahon]

    Joined:
    Apr 11, 2016
    Messages:
    1,008
    Likes Received:
    702
    Reading List:
    Link
    Not really im just trying it out. I will say its easier and more difficult then what I first thought it would be about, for example I made a calculator and that was quite a lot different from what I had imagined. Even though I didnt have a clear view of how it would be mad before that. And great spelling and or punctuation is pretty essential.
     
  17. manto98

    manto98 Active Member

    Joined:
    Sep 27, 2016
    Messages:
    4
    Likes Received:
    3
    Reading List:
    Link
    Remember to put in the head section of the html if u want to use an external css file
    Code:
    <head>
       <link rel="stylesheet" type="text/css" href="nameofyourcss.css">
    </head>
    In the css u can use # when u want to define a rule for an id
    example
    HTML:
    #list{
          font-famility: calibri;
          color: green;
          size: 24px;
    }
    then in the html u write like this
    HTML:
    <ul id="list">
       <li>element</li>
       <li>element2</li>
    </ul>
    this way the css know that u are refererring to a certain item in the html
    If u want to define a class u have to put the . before the name of the class in the css
    HTML:
    .classname{
       size: 45px;
       width: 80%;
       border: 1px solid black;
       margin: 10%;
    }
    Then put the class into the html
    HTML:
    <p class="classname" >test here</p>
    if u want to give a general definition for the style of the page
    u can refer to the type of elements
    For example if u want the background red
    HTML:
    body{
       background-color: red;
    }
    or all the paragraphed text in green
    HTML:
    p{
         color: green;
    }
    Rember that the priority for the css are like this:
    general tag definition->class definition->id definition
    And inline css has priority over the external css file
    Sorry for the bad English:)
     
    Little Big House and ElTorroLoco like this.
  18. Alvastar

    Alvastar Well-Known Member

    Joined:
    Nov 15, 2015
    Messages:
    645
    Likes Received:
    619
    Reading List:
    Link
    I strongly advise against in-line styling of individual elements inside the HTML. It's one thing if you've already built CSS files and your website is styled properly, then you happen to use the style attribute of an element to quickly change text. Otherwise, you're going to be essentially hammering your foot later when you realize that not separating out your presentation from your content is resulting in a mess that you spend hours or days trying to figure out why something is happening that you had no intention to occur.

    Look into this book. It's easily explained and teaches you good habits for learning HTML and CSS through practical tutorials.
     
  19. fuzor100

    fuzor100 Standby mode...

    Joined:
    Mar 14, 2016
    Messages:
    2,096
    Likes Received:
    5,158
    Reading List:
    Link
    Ok. But it just much better to get a book that have teach both html and css so you won't have any difficulty in styling.
    styling in html is unnecessary. You can learn it, but it become obsolete when you learn css.
     
  20. DarkArts

    DarkArts ✫ First Ancestor of the Assassin Sect ✫

    Joined:
    Oct 22, 2015
    Messages:
    3,309
    Likes Received:
    1,222
    Reading List:
    Link
    I would say it's not that hard and it can be very interesting at times. What is a bit more difficult is the math part of it. I did take this course in college and had lots of math as well and I really hate math and for many problems in programming you actually do need math.
    I disagree with this. I think that for learning it's best if he starts with HTML and have some inline style at the beginning because then it'll be easier for him to learn and use CSS because he already learned some if not most of the parameters.
     
    Last edited: Jun 26, 2017
    ElTorroLoco likes this.