Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS How to make all boxes visible

  • This topic is empty.
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #178954
    Geldon
    Participant

    I want to make all boxes around all elements visible. I do this because I am re-learning css and want to be able to see the boxes.( I guess this is called the box model? Not sure if that is the proper terminology.) What I currently do is just add
    border-style: solid;
    border-width: 1px;
    <code></code>

    To everything, but this is tedious when you have 100s of styles. Is there a program or browser plugin I can use to turn off/turn on the box models? With firebug, I can highlight various boxes, but I cannot force all to be visible at once – only the highlighted versions.

    If there is no program available, css-based solutions would be helpful as well. But since border styles are not inherited, I am not sure what to do.

    #178955
    jurotek
    Participant

    You can apply border property with universal selector like so

    *{border:1px solid red}
    &lt;code&gt;&lt;/code&gt;

    #178956
    chrisburton
    Participant
    * { border: 1px solid red; }
    


    @jurotek
    Don’t forget to end with a semicolon!

    #178958
    Alen
    Participant

    Maybe this can give you some ideas

    http://codepen.io/alenabdula/pen/mdvJk

    #178961
    Alen
    Participant

    Don’t forget to end with a semicolon!

    If that’s the last property declaration you don’t need a semicolon, so this

    
    .row {
       display:block;
       padding:10px;
       margin: 40px 40px
    }
    

    Will work just fine. CSS and HTML are so forgiving in this way as they fail silently.

    Watch this, skip to 6min mark for full talk or about 20min in related to this topic
    http://vimeo.com/79556632

    You should really watch the full talk tho!!! Highly recommended.

    #178962
    nixnerd
    Participant

    If that’s the last property declaration you don’t need a semicolon

    Alen beat me to it. I was going to say this but I always add one because if I add properties… I always do it below. Saves me the hassle of having to do it later.

    #178963
    Alen
    Participant

    I always close with ; I’m OCD like that!

    #178964
    nixnerd
    Participant

    I always close with ; I’m OCD like that!

    Dude, especially if you nest in SCSS. Shit can hairy real fast.

    #178966
    chrisburton
    Participant

    If that’s the last property declaration you don’t need a semicolon, so this

    What?! I never knew this.

    #178969
    Alen
    Participant

    I guess parser reads values like this, finds

    margin then sets the value 40px then 40px then sees closing } it ends the statement. Values have been set already and the last value is not followed by any illegal character. CSS is cool like that.

    #178970
    Alen
    Participant

    Sites like http://cssbeautify.com will add those for you. See “Automatic Semicolon”

    #178971
    Geldon
    Participant

    Thanks, jurotek.
    And I didn’t know about the optional semi-colon either in the following interesting discussion.

    For my future reference, what is the terminology to refer to the boxes of all elements?

    #178997
    Alen
    Participant

    The * {} is EVERYTHING selector.

    This will select body, all div‘s and everything else. This will indeed show you everything, but again you wouldn’t know which one is which. Are you looking at the div or li, you wouldn’t know. You’re just making it more complicated. If you’re trying to learn layout go check out http://learnlayout.com.

    There’s also http://learn.shayhowe.com/html-css/ and http://learn.shayhowe.com/advanced-html-css/

    #179002
    Geldon
    Participant

    I understand the universal selector, but didn’t consider applying it here.

    But I was just asking in my previous question if there was a term for the borders of all page elements.

    Thanks for the links.

Viewing 14 posts - 1 through 14 (of 14 total)
  • The forum ‘CSS’ is closed to new topics and replies.