Answer the question
In order to leave comments, you need to log in
How to make grid layout so that elements occupy a certain number of columns, regardless of position?
I have a block of 15 identical elements. I laid it out in 5 column grids:
I want to achieve the same effect, only with 20 columns: grid-template-columns: repeat(20, 1fr);
. grid-area
I do not want to manually set the elements . Maybe there is another option? For example, some property grid-space
for the number of columns occupied, regardless of the position.
Sandbox
Answer the question
In order to leave comments, you need to log in
You can simplify your code like this
goods = ['Товар1', 'Товар2', 'Товар3', 'Товар4', 'Товар5', 'Товар6', 'Товар7', 'Товар8', 'Товар9', 'Товар10', 'Товар11', 'Товар12']
@bot.message_handler(func=lambda mess: "Продукция1" == mess.text, content_types=['text'])
def handle_text(message):
keyboard = types.ReplyKeyboardMarkup(row_width=2, resize_keyboard=True, one_time_keyboard=False)
for goods_item in goods:
keyboard.row(goods_item)
bot.send_message(message.from_user.id, "Выберите товар", reply_markup=keyboard)
@bot.message_handler(func=lambda mess: mess.text in goods, content_types=['text'])
def handle_text(message):
keyboard = types.ReplyKeyboardMarkup(row_width=2, resize_keyboard=True, one_time_keyboard=False)
if message.text in goods:
bot.send_message(message.chat.id, "", reply_markup=keyboard )
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question