Treehouse: Grow your CSS skills. Land your dream job.

Fieldset Question

  • # March 27, 2013 at 4:53 pm

    is there any way to remove the white boarder you get when a fieldset is inserted?

    I checked the html file with xhtml strict validation and it said I needed to use fieldset around an img but now its giving me an ugly white boarder?

    img class=”flagnk” src=”North%20Korea.jpg” alt=”North Korea” width=”304″ height=”228″ />

    (i didnt put the <’s in this msg because it kept just displaying it as “North Korea”)

    # March 27, 2013 at 5:00 pm

    fieldset {
    border: 0;

    # March 27, 2013 at 5:03 pm

    so i would put (class=”fieldset”) right above the actual (fieldset)

    using ( instead of < for right now..

    # March 27, 2013 at 5:22 pm

    so when i get this error:

    Line 19, Column 84: document type does not allow element “img” here; missing one of “p”, “h1″, “h2″, “h3″, “h4″, “h5″, “h6″, “div”, “address”, “fieldset”, “ins”, “del” start-tag

    …class=”argflag” src=”Argentina.jpg” alt=”Argentina” width=”304″ height=”228″ />

    The mentioned element is not allowed to appear in the context in which you’ve placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you’ve forgotten to close a previous element.

    One possible cause for this message is that you have attempted to put a block-level element (such as “

    ” or “

    “) inside an inline element (such as ““, ““, or ““).

    would fieldset be the proper one to choose or is there one I SHOULD be choosing which does not have this ugly border?

    # March 27, 2013 at 5:30 pm

    Doubt fieldset is the best choice here but would need to see more of the page. Chris’ solution is purely css, no extra markup needed, it’s using an element selector, not a class selector.

    Anyway don’t use fieldset, that’s (only) for forms afaik. Try div or p. Any reason you’re using xhtml and not html5?

    # March 27, 2013 at 5:40 pm

    ok, i was using html5 then this instructor says everything has to pass validation with xhtml strict 1.0 so i had to change it to xhtml and make sure it passes..

    Isnt (P) just to make a paragraph?

    i tried it and got an error

    (img class=”argflag” src=”Argentina.jpg” alt=”Argentina” width=”304″ height=”228″ /)

    Line 18, Column 3: element “P” undefined


    again i replaced the < with (

    # March 27, 2013 at 5:49 pm

    I see, instructor’s living in the past.

    Yes, `

    ` is a paragraph. Try lowercase, I think xhtml is case sensitive.

    # March 27, 2013 at 6:03 pm

    nice that worked, thanks dude..

    and for spaces rather then using (br) im doing:


    that right?

    # March 27, 2013 at 6:08 pm


    No, `

    ` is if you want to keep white-space, it's mostly used for blocks of code, to keep the line-breaks and the indentation. You normally wouldn't need `
    ` either, I never need them anyway. If you need space between blocks of text consider using paragraphs instead and use css to control the space between them (with margin, there should be some by default if you aren't using a reset).
    # March 27, 2013 at 6:12 pm

    ok, so your saying HTML5 will be the new standard, xhtml strict 1.0 is fading away?

    # March 27, 2013 at 6:24 pm

    Most modern websites are html5 now yeah. I still like xhtml though, luckily in html5 you can stick to xhtml things like selfclosing tags. I don’t like parts of the spec where it’s okay to not close paragraphs or list items. But I like the clean doctype (one I can remember and not having to copy paste every time), the short charset meta, the short link and script tags and a whole lot of other things.

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.