Project

General

Profile

Actions

Feature #7307

closed

Padding top/bottom not applied

Added by max p over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
11/04/2019
Due date:
% Done:

0%

Estimated time:

Description

Let's consider the following code:

this->setContentAlignment(Wt::AlignmentFlag::Center);

auto text = this->addWidget(std::make_uniqueWt::WText("Login functionality is locked for 15 minutes"));

text->setInline(false);

text->decorationStyle().setBackgroundColor(Wt::StandardColor::Red);

text->setHeight(50);

text->setWidth(400);

text->decorationStyle().font().setWeight(Wt::FontWeight::Bold);

text->setPadding(15, Wt::Side::Top);

text->setPadding(0, Wt::Side::Left | Wt::Side::Right | Wt::Side::Bottom);

text->decorationStyle().setForegroundColor(Wt::StandardColor::White);

Wt applies left and right padding of value 0px, but the top and bottom padding are not applied. They are just missing, thus the text is not distanced from the top border of the div.

Actions #1

Updated by Roel Standaert over 4 years ago

Hm, WText is actually documented as not supporting top and bottom padding: https://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WText.html#aee27c81fbfa510a80681d4cf5b80060b

You should see an error in your logs notifying you of the fact.

The reason for this is that inline HTML elements do not support top and bottom padding (it has no effect).

However, WText can be set to non-inline, as I see that's what you're doing. In that case, setting top and bottom padding does make sense, so maybe we can consider supporting that.

Actions #2

Updated by Roel Standaert over 4 years ago

  • Tracker changed from Bug to Feature
  • Status changed from New to Resolved

I pushed a fix. It is now possible to set top/bottom padding if a WText is not inline. If it is inline, you will get a warning about it not being supported, but it will still be applied anyway.

Actions #3

Updated by Roel Standaert over 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF