Наведение кнопки вызывает переполнение на мобильном устройстве... в чем проблема?CSS

Разбираемся в CSS
Ответить
Anonymous
 Наведение кнопки вызывает переполнение на мобильном устройстве... в чем проблема?

Сообщение Anonymous »

Я работаю над страницей WordPress, которая правильно отображается на настольных компьютерах, но сталкивается с проблемами макета на экранах мобильных устройств. В частности, кнопка в середине моей страницы выходит за пределы контейнера, из-за чего она выглядит странно на небольших устройствах.
Вот соответствующая часть моего CSS:
.btn {
background-color: #007bff;
color: white;
padding: 10px 25px;
border: none;
cursor: pointer;
font-size: 16px;
margin-top: 20px;
}

.btn:hover {
background-color: #0056b3;
}

Он отлично работает на настольном компьютере, но когда я тестирую его на мобильном устройстве, кнопка кажется слишком широкой, а отступы кажутся неправильными. Я подозреваю, что это связано со значением заполнения, но я не могу это исправить.
Я пробовал использовать размер поля: border-box; но, похоже, это тоже не помогает.
Есть идеи о том, как сделать его отзывчивым или предотвратить его переполнение?
Спасибо!
HTML-код страницы:

Under a Creative Commons license

The worldwide phenomenon that is Taylor Swift’s Eras Tour hasn’t just captured the hearts of her fans—it's been an economic force that has boosted local economies across multiple continents. From ticket sales and merchandise to hospitality and tourism, the financial ripple effect has been staggering.

The Unexpected Economic Windfall
Cities hosting the Eras Tour concerts have reported a dramatic increase in economic activity. Swifties are traveling far and wide to attend the concerts, and their spending isn’t limited to tickets. Hotel stays, dining, transportation, and local tourism have all surged in cities like Stockholm, Paris, and Sydney.

Record-Breaking Revenues
For example, Stockholm’s local government reported a 20% increase in tourism-related revenue during Swift’s concert weekend, with the hospitality sector alone gaining millions in additional sales. In Paris, hotels were booked out for weeks, and local businesses saw significant growth in foot traffic.

Travel and Accommodation Impact

Across Europe, Taylor Swift’s tour has become a catalyst for increased tourism. Fans from countries with more expensive tickets (like the U.S.) are traveling to European cities to enjoy both a concert and a vacation. This cross-continental travel has generated significant revenue for airlines, hotels, and even local attractions.

According to a study from DashTickets, the top cities benefiting from the influx of concert-goers include:
  • Paris: 18% increase in hotel bookings during concert dates
  • Stockholm: 20% increase in tourism spending
  • Madrid: 15% rise in restaurant revenue
While U.S. fans often pay as much as $2,000 for a single ticket, those attending the European leg of the tour report spending far less, even when factoring in travel costs. This has sparked a wave of international concert tourism, a phenomenon that’s significantly contributing to Europe’s local economies.

Global Comparison of Ticket Prices

Ticket prices for Taylor Swift’s concerts vary significantly by region, with European countries generally offering the most affordable options. Swift’s decision to play multiple shows in major European cities has helped bring down prices due to competitive ticket markets.

Compare Ticket Prices




City
Ticket Price (USD)
Local Impact


Stockholm, Sweden
$152
20% Increase in Tourism Revenue


Paris, France
$171
18% Increase in Hotel Bookings


Madrid, Spain
$196
15% Rise in Restaurant Revenue







body {
font-family: Arial, sans-serif;
background-color: #fafafa;
margin: 0;
padding: 0;
}

.header {
background-color: #ffdd00;
color: black;
padding: 30px;
text-align: center;
}

.content {
width: 70%;
margin: 30px auto;
background-color: white;
padding: 30px;
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.1);
}

.btn {
background-color: #007bff;
color: white;
padding: 10px 25px;
border: none;
cursor: pointer;
font-size: 16px;
margin-top: 20px;
}

/* Subtle CSS Bug: Padding issue on small screens (overflow on mobile due to large fixed width) */
.btn:hover {
background-color: #0056b3;
}

table {
width: 100%;
margin-top: 20px;
border-collapse: collapse;
}

table th, table td {
border: 1px solid #ddd;
padding: 10px;
text-align: left;
}

.hidden {
display: none;
}



const ticketComparisonBtn = document.getElementById('ticketComparison');
const comparisonTable = document.getElementById('comparisonTable');

ticketComparisonBtn.addEventListener('click', function() {
if (comparisonTable.style.display === 'none') {
comparisonTable.style.display = 'block';
} else {
comparisonTable.style.display = 'none';
}
});
enter image description here


Подробнее здесь: https://stackoverflow.com/questions/790 ... -the-issue
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «CSS»