Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CssBuilder:
- def __init__(self):
- self.css = ""
- def add_style(self, style):
- self.css += style.render()
- def get_css(self):
- return self.css
- class CssStyle(ABC):
- @abstractmethod
- def render(self):
- pass
- class DivStyle(CssStyle):
- def render(self):
- return "div { margin: 10px; }\n"
- class LabelStyle(CssStyle):
- def render(self):
- return "label { font-size: 14px; color: #333; }\n"
- class InputStyle(CssStyle):
- def render(self):
- return "input[type='text'] { padding: 5px; }\n"
- class SelectStyle(CssStyle):
- def render(self):
- return "select { width: 100px; }\n"
- class SubmitStyle(CssStyle):
- def render(self):
- return "input[type='submit'] { background-color: #4CAF50; color: white; }\n"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement