Skip to main content
s_d48391518
Participant
May 19, 2017
Answered

Dreamweaver - tag / span ohne Inhalt löschen

  • May 19, 2017
  • 2 replies
  • 627 views

Gibt es unter Dreamweaver (CS 6) die Möglichkeit, tags bzw. spans "ohne Inhalt" mit einem Schlag zu löschen?

Also:

<span class="X"></span>

oder

<p class="X"></p>

Liebe Grüße

Sabine

This topic has been closed for replies.
Correct answer Jon Fritz

You should be able to use DW's Find & Replace tool.

Hit Ctrl + F
Change the Find In menu to Current Document
Change the Search menu to Specific Tag
Change the Specific Tag menu to span
Click the + button

Change the new menu to Not Containing
Change the next menu to Text
Put a space in the text field

Change the Action to Remove Tag and Contents

Test it by clicking the Find Next button on the right side. It should select the first empty <span> tag in your code. Clicking Replace will delete it. Clicking Replace All will delete all empty <span> tags from your code.


Do the same thing for each empty tag type you want to remove, changing span to p for example.

2 replies

s_d48391518
Participant
June 9, 2017

It don't work with:

<span class="italic">WORD</span>...

It's a lot of text. So I want a way, to delet all.

Jon Fritz
Community Expert
Community Expert
June 9, 2017

If you want to strip <span> tags without removing their content, you would use the same F&R tool, with slightly different settings...

1. Open the Find & Replace tool
2. Change "Find In" to "Current Document" and the tag dropdown to "span"
3. Set the "Action" to "Strip Tag"
4. Click Replace All

This will delete all <span> tags while leaving the content of the tag behind.

If that does what you want, you can then change the Find In field to "Entire Current Local Site to repeat the same action across all of your pages.

s_d48391518
Participant
June 9, 2017

Sorry, my english is not good.

I want to strip spans "without" text or "without" spaces, like this: <span class="italic"></span>, <span class="bold"></span>, ect. with "Replace All".

Jon Fritz
Community Expert
Jon FritzCommunity ExpertCorrect answer
Community Expert
May 19, 2017

You should be able to use DW's Find & Replace tool.

Hit Ctrl + F
Change the Find In menu to Current Document
Change the Search menu to Specific Tag
Change the Specific Tag menu to span
Click the + button

Change the new menu to Not Containing
Change the next menu to Text
Put a space in the text field

Change the Action to Remove Tag and Contents

Test it by clicking the Find Next button on the right side. It should select the first empty <span> tag in your code. Clicking Replace will delete it. Clicking Replace All will delete all empty <span> tags from your code.


Do the same thing for each empty tag type you want to remove, changing span to p for example.