Lena Bru
Lena Bru

Reputation: 13937

how to change eclipse html formatting

When i open an html file in eclipse, after i format it, it looks like this:

<form>
            <fieldset>
                <label for="memberName">Login Name:</label> <input type="text"
                    name="memberName" id="memberName" value=""
                    class="text ui-widget-content ui-corner-all" /> <label
                    for="memberPass">Password:</label> <input type="password"
                    name="memberPass" id="memberPass" value=""
                    class="text ui-widget-content ui-corner-all" />


            </fieldset>
        </form>

but i want each tag with all of its attributes on the same line

how do i make eclipse understand that?

Upvotes: 24

Views: 15683

Answers (4)

Aashish Verma
Aashish Verma

Reputation: 103

Go to Window->Preferences->Web->HTML Files->Editor

  1. Remove all inline elements
  2. Set Line width to 200 or more
  3. set indentation size at 1

Apply and Close, Now format your code by pressing ctrl+Shift+F

enter image description here

Upvotes: 4

ali akbar azizkhani
ali akbar azizkhani

Reputation: 2279

To change the formatting as usual, go to Window->Preferences->Web->HTML Files->Editor, and remove all inline Elements like this:

enter image description here

Upvotes: 9

RoiEX
RoiEX

Reputation: 1225

Under

Window->Preferences->Web->HTML Files->Editor

there are some options in terms of HTML formatting.

In comparison to Java, there are almost no options available, but maybe you can figure out on what to do.

Upvotes: 4

Khaled Obaid
Khaled Obaid

Reputation: 275

You can find the answer here how to turn off break line in eclipse

Follow these steps to Not wrap.

Go to Window->Preferences->Java->Code Style->Formatter. Create new formatter. Click on edit and then pick tab Line Wrapping and set Line Wrapping policy to Do not wrap.

Upvotes: 2

Related Questions