Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML HTML Forms Fieldsets and Labels

Veljko Mirkovic
Veljko Mirkovic
3,818 Points

Is it possible to set a width for a fieldset using only HTML?

Can you set certain visual attributes to the <code>fieldset</code> element such as width, height?

EDIT: Only using HTML and no css styling or js.

2 Answers

Chris Shaw
Chris Shaw
26,676 Points

Hi Veljko,

The short answer is no you can't, only elements that support dimension attributes allow explicit values to be set via HTML otherwise you will need to use CSS.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fieldset

Paul Murphy
Paul Murphy
6,162 Points

Yes you can use inline styling after the opening tag of the element i.e.

<a href="example.com" style="background-color: blue; padding: 5px;"></a> etc 

It's not advised to style elements in this way though, it is better to use a separate style sheet Keep content and style separate.

Veljko Mirkovic
Veljko Mirkovic
3,818 Points

Sorry for being unclear. Is it possible to do it only using HTML, no css or js?

Paul Murphy
Paul Murphy
6,162 Points

Apologies.... Chris is right, my answer was based on using the style attribute in a html document.