Jump to content
  • 0

Адаптивный шаблон страницы. Шапка не смещается.


newjmrec1@gmail.com
 Share

Question

Здравствуйте! Помогите пожалуйста. Совмещаю html с css для создания адаптивного шаблона для рассылки писем. Вроде все адаптируется, но только шапка в мобильной версии почему-то смещается влево. Все перерыл, не могу понять почему. Спасибо!

 

PS Возможно имеется лишний код, мог лишний раз куда-то добавить строчки из css.

 

left.pngright.jpg

<html xmlns="http://www.w3.org/1999/xhtml"><head>	<style type="text/css">.container {	display:block!important;	max-width:600px!important;	margin:0 auto!important; /* makes it centered */	clear:both!important;}	</style>	<style type="text/css">.content {	padding:15px;	max-width:600px;	margin:0 auto;	display:block;	</style>	<style type="text/css">.content table { width: 100%; }	</style>	<style type="text/css">.column {	width: 300px;	float:left;}.column tr td { padding: 15px; }.column-wrap { 	padding:0!important; 	margin:0 auto; 	max-width:600px!important;}.column table { width:100%;}.social .column {	width: 280px;	min-width: 279px;	float:left;}	</style>	<style type="text/css">ul.sidebar {	background:#ebebeb;	display:block;	list-style-type: none;}ul.sidebar li { display: block; margin:0;}ul.sidebar li a {	text-decoration:none;	color: #666;	padding:10px 10px;/* 	font-weight:bold; */	margin-right:10px;/* 	text-align:center; */	cursor:pointer;	border-bottom: 1px solid #777777;	border-top: 1px solid #FFFFFF;	display:block;	margin:0;}ul.sidebar li a.last { border-bottom-width:0px;}ul.sidebar li a h1,ul.sidebar li a h2,ul.sidebar li a h3,ul.sidebar li a h4,ul.sidebar li a h5,ul.sidebar li a h6,ul.sidebar li a p { margin-bottom:0!important;}	</style>	<style type="text/css">h1,h2,h3,h4,h5,h6 {font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; line-height: 1.1; margin-bottom:15px; color:#000;}h1 small, h2 small, h3 small, h4 small, h5 small, h6 small { font-size: 60%; color: #6f6f6f; line-height: 0; text-transform: none; }h1 { font-weight:200; font-size: 42px;}h2 { font-weight:200; font-size: 37px;}h3 { font-weight:500; font-size: 27px;}h4 { font-weight:500; font-size: 23px;}h5 { font-weight:900; font-size: 17px;}h6 { font-weight:900; font-size: 14px; text-transform: uppercase; color:#444;}.collapse { margin:0!important;}p, ul { 	margin-bottom: 10px; 	font-weight: normal; 	font-size:13px; 	line-height:1.6;}p.lead { font-size:17px; }p.last { margin-bottom:0px;}ul li {	margin-left:5px;	list-style-position: inside;}	</style>	<style type="text/css">{ 	margin:0;	padding:0;}* { font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif; }img { 	max-width: 100%; }.collapse {	margin:0;	padding:0;}body {	-webkit-font-smoothing:antialiased; 	-webkit-text-size-adjust:none; 	width: 100%!important; 	height: 100%;}	</style>	<!-- If you delete this tag, the sky will fall on your head --><meta name="viewport" content="width=device-width">	<title>Центр Рушеля Блаво</title></head><body bgcolor="#FFFFFF" style="cursor: col-resize;"><style type="text/css">.container {	display:block!important;	max-width:600px!important;	margin:0 auto!important; /* makes it centered */	clear:both!important;}</style><!-- HEADER --><style type="text/css">table.head-wrap { width: 100%;}.header.container table td.logo { padding: 15px; }.header.container table td.label { padding: 15px; padding-left:0px;}</style><table bgcolor="#999999" class="head-wrap">	<tbody>		<tr>			<td></td>			<td class="header container">			<style type="text/css">.container {	display:block!important;	max-width:600px!important;	margin:0 auto!important; /* makes it centered */	clear:both!important;}			</style>			<div class="content">			<style type="text/css">.content {	padding:15px;	max-width:600px;	margin:0 auto;	display:block;			</style>			<style type="text/css">.content table { width: 100%; }			</style>			<table bgcolor="#999999">				<tbody>					<tr>						<td>						<style type="text/css">table.head-wrap { width: 100%;}						</style>						<img src="http://placehold.it/200x50/" /></td>						<td align="right">						<style type="text/css">table.head-wrap { width: 100%;}						</style>						<h6 class="collapse" style="text-align: right;">Hero</h6>						</td>					</tr>				</tbody>			</table>			</div>			</td>			<td>			<style type="text/css">table.head-wrap { width: 100%;}			</style>			</td>		</tr>	</tbody></table><!-- /HEADER --><!-- BODY --><style type="text/css">table.body-wrap { width: 100%;}</style><table class="body-wrap">	<tbody>		<tr>			<td></td>			<td bgcolor="#FFFFFF" class="container">			<div class="content">			<style type="text/css">table.body-wrap { width: 100%;}			</style>			<table>				<tbody>					<tr>						<td>						<h3>Welcome, Elijah Baily</h3>						<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et.</p>						<!-- A Real Hero (and a real human being) -->						<style type="text/css">a { color: #2BA6CB;}.btn {	text-decoration:none;	color: #FFF;	background-color: #666;	padding:10px 16px;	font-weight:bold;	margin-right:10px;	text-align:center;	cursor:pointer;	display: inline-block;}p.callout {	padding:15px;	background-color:#ECF8FF;	margin-bottom: 15px;}.callout a {	font-weight:bold;	color: #2BA6CB;}table.social {/* 	padding:15px; */	background-color: #ebebeb;	}.social .soc-btn {	padding: 3px 7px;	font-size:12px;	margin-bottom:10px;	text-decoration:none;	color: #FFF;font-weight:bold;	display:block;	text-align:center;}a.fb { background-color: #3B5998!important; }a.tw { background-color: #1daced!important; }a.gp { background-color: #DB4A39!important; }a.ms { background-color: #000!important; }.sidebar .soc-btn { 	display:block;	width:100%;}						</style>						<p><img src="http://placehold.it/600x300" /></p>						<!-- /hero --><!-- Callout Panel -->						<p class="callout">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt. <a href="javascript:;" target="_self">Do it Now! »</a></p>						<!-- /Callout Panel -->						<h3>Title Ipsum <small>This is a note.</small></h3>						<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>						<a class="btn">Click Me!</a><br />						<br />						<!-- social & contact -->						<style type="text/css">table.body-wrap { width: 100%;}						</style>						<table class="social" width="100%">							<tbody>								<tr>									<td><!— column 1 -->									<style type="text/css">table.body-wrap { width: 100%;}									</style>									<table align="left" class="column">										<tbody>											<tr>												<td>												<h5>Connect with Us:</h5>												<p><a class="soc-btn fb" href="javascript:;" target="_self">Facebook</a> <a class="soc-btn tw" href="javascript:;" target="_self">Twitter</a> <a class="soc-btn gp" href="javascript:;" target="_self">Google+</a></p>												</td>											</tr>										</tbody>									</table>									<!-- /column 1 --><!— column 2 -->									<style type="text/css">table.body-wrap { width: 100%;}									</style>									<table align="left" class="column">										<tbody>											<tr>												<td>												<h5>Contact Info:</h5>												<p>Phone: <strong>408.341.0600</strong><br />												Email: <strong><a href="emailto:hseldon@trantor.com">hseldon@trantor.com</a></strong></p>												</td>											</tr>										</tbody>									</table>									<!-- /column 2 --></td>								</tr>							</tbody>						</table>						<!-- /social & contact --></td>					</tr>				</tbody>			</table>			</div>			</td>			<td></td>		</tr>	</tbody></table><!-- /BODY --><!-- FOOTER --><style type="text/css">table.footer-wrap { width: 100%;	clear:both!important;}.footer-wrap .container td.content  p { border-top: 1px solid rgb(215,215,215); padding-top:15px;}.footer-wrap .container td.content p {	font-size:10px;	font-weight: bold;	}</style><table class="footer-wrap">	<tbody>		<tr>			<td></td>			<td class="container"><!-- content -->			<div class="content">			<table>				<tbody>					<tr>						<td align="center">						<p><a href="javascript:;" target="_self">Terms</a> | <a href="javascript:;" target="_self">Privacy</a> | <a href="javascript:;" target="_self"><unsubscribe>Unsubscribe</unsubscribe></a></p>						</td>					</tr>				</tbody>			</table>			</div>			<!-- /content --></td>			<td></td>		</tr>	</tbody></table><!-- /FOOTER --><style type="text/css">table.body-wrap { width: 100%;}</style></body></html>
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Similar Content

    • By zeiger2
      Здравствуйте! У меня стоит задача, что при наведении на блок li строка должна поменять цвет, в том числе и картинка. Я меняю картинку с помощью 
      background-image: none;     background: url(../img/check_icon_red.png) left no-repeat;   Но теперь картинка позицианируется не там где должна, её можно поставить на место только вручную, через -100px. Нужно поставить ровно туда, где она была. Должна быть в одном ряду с другими
    • By Mix9
      есть див с 5 img, при уменьшении экрана див выходит за него. Я добавил overflow: auto для этого div в надежде на то, что я смогу прокручивать фотки с помощью скроллбара, однако даже с ним почему-то я не вижу часть фоток которые вышли за границу. Что с этим можно сделать? класс video повторяется 5 раз, я тут оставил только 1 
      .content{ width: 90%; background-color: #333; } .video{ margin: 0px 4px 0px 4px; width: 310; display: flex; flex-direction:column; } .video_button_text{ margin-top: 10px; display: flex; flex-direction: row; font-size: 20px; color: white; } .video_text_div{ display: inline-block; width: 250px; } .video_text{ text-align: justify-all; margin: 0px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; } .slidan_videos{ margin: 0px 10px 0px 20px; overflow: auto; width: auto; margin-bottom: 50px; display: flex; flex-direction: row; justify-content: space-around; } <div class="content"> <div class = slidan_videos> <div class = video> <div> <a href = 'ссылка'><img class="img" src=""картинка"></a> </div> <div class = video_button_text> <div class = avatarka_div> <a href="ссылка" target="_blank"><img class = avatarka src="картинка"></a> </div> <div class = video_text_div> <p class = video_text><a href="ссылка">текст</a></p> </div> </div> </div>
    • By Марко
      Добрый день. Начинающий программист, столкнулся с проблемой. Селектор .class не работает должным образом. Несмотря на правильное, я надеюсь, описание, на web-странице не отображается ни одно изображение. С чем может быть связано? Заранее спасибо за помощь. 



    • By Kaido
      Использую готовый плагин для модальных окон(от MaxGraph). Проблема в том, что когда у меня открыто два модальных окна, для примера Форма + Политика конфендициальности, и мне нужно закрыть политику вместе с ней закрывается и другое модальное окно. В JS я не сильно разбираюсь(собственно из за этого и использую готовый плагин), можете помочь кто работал с этим плагином? Я примерно понимаю как он работает, но реализовать чтобы закрывалось только одно не получается.
       
        <div class="content"> <button class="modal-btn" data-path="first" data-animation="fadeInUp" data-speed="1500">Открыть окно 1</button> </div> <div class="modal"> <div class="modal__wrapp" data-target="first"> <div class="modal__content"> <button class="modal__close">Закрыть</button> модальное окно <button data-path="policy">Политика</button> </div> </div> <div class="modal__wrapp" data-target="policy"> <div class="modal__content"> <button class="modal__close">Закрыть</button> политика </div> </div> </div> .modal { --transition-time: 0.3s; position: fixed; left: 0; top: 0; right: 0; bottom: 0; z-index: 1000; cursor: pointer; overflow-y: auto; overflow-x: hidden; text-align: center; opacity: 0; visibility: hidden; transition: opacity var(--transition-time), visibility var(--transition-time); } .modal__wrapp { display: none; cursor: default; width: fit-content; height: fit-content; } .modal__content{ position: absolute; left: 500px; width: 500px; height: 500px; display: flex; color: white; flex-direction: column; text-align: left; background-color: #000; } .modal__content button{ width: 200px; height: 50px; margin: 50px 0; } .modal.is-open { opacity: 1; visibility: visible; transition: opacity var(--transition-time), visibility var(--transition-time); } .modal__wrapp.modal-open { display: flex; } .disable-scroll { position: relative; overflow: hidden; height: 100vh; position: fixed; left: 0; top: 0; width: 100%; } .fade { opacity: 0; transition: opacity var(--transition-time); } .fade.animate-open { opacity: 1; transition: opacity var(--transition-time); } .fadeInUp { opacity: 0; transform: translateY(vw(-100)); transition: opacity var(--transition-time), transform var(--transition-time); } .fadeInUp.animate-open { opacity: 1; transform: translateY(0); transition: opacity var(--transition-time), transform var(--transition-time); } .modal__wrapp[data-target="policy"] .modal__content{ left: 1050px; background-color: #000; opacity: .5; } class Modal { constructor(options) { let defaultOptions = { isOpen: () => {}, isClose: () => {}, } this.options = Object.assign(defaultOptions, options); this.modal = document.querySelector('.modal'); this.speed = false; this.animation = false; this.isOpen = false; this.modalContainer = false; this.previousActiveElement = false; this.fixBlocks = document.querySelectorAll('.fix-block'); this.focusElements = [ 'a[href]', 'input', 'button', 'select', 'textarea', '[tabindex]' ]; this.events(); } events() { if (this.modal) { document.addEventListener('click', function(e){ const clickedElement = e.target.closest('[data-path]'); if (clickedElement) { let target = clickedElement.dataset.path; let animation = clickedElement.dataset.animation; if (clickedElement.classList.contains('modal-close')) { this.close(); } let speed = clickedElement.dataset.speed; this.animation = animation ? animation : 'fade'; this.speed = speed ? parseInt(speed) : 300; this.modalContainer = document.querySelector(`[data-target="${target}"]`); this.open(); return; } if (e.target.closest('.modal__close')) { this.close(); return; } }.bind(this)); window.addEventListener('keydown', function(e) { if (e.keyCode == 27) { if (this.isOpen) { this.close(); } } if (e.keyCode == 9 && this.isOpen) { this.focusCatch(e); return; } }.bind(this)); this.modal.addEventListener('click', function(e) { if (!e.target.classList.contains('modal__wrapp') && !e.target.closest('.modal__wrapp') && this.isOpen) { this.close(); } }.bind(this)); } } open() { this.previousActiveElement = document.activeElement; this.modal.style.setProperty('--transition-time', `${this.speed / 1000}s`); this.modal.classList.add('is-open'); this.disableScroll(); this.modalContainer.classList.add('modal-open'); this.modalContainer.classList.add(this.animation); setTimeout(() => { this.options.isOpen(this); this.modalContainer.classList.add('animate-open'); this.isOpen = true; this.focusTrap(); }, this.speed); } close() { if (this.modalContainer) { this.modalContainer.classList.remove('animate-open'); this.modalContainer.classList.remove(this.animation); this.modal.classList.remove('is-open'); this.modalContainer.classList.remove('modal-open'); this.enableScroll(); this.options.isClose(this); this.isOpen = false; this.focusTrap(); } } focusCatch(e) { const focusable = this.modalContainer.querySelectorAll(this.focusElements); const focusArray = Array.prototype.slice.call(focusable); const focusedIndex = focusArray.indexOf(document.activeElement); if (e.shiftKey && focusedIndex === 0) { focusArray[focusArray.length - 1].focus(); e.preventDefault(); } if (!e.shiftKey && focusedIndex === focusArray.length - 1) { focusArray[0].focus(); e.preventDefault(); } } focusTrap() { const focusable = this.modalContainer.querySelectorAll(this.focusElements); if (this.isOpen) { focusable[0].focus(); } else { this.previousActiveElement.focus(); } } disableScroll() { let pagePosition = window.scrollY; this.lockPadding(); document.body.classList.add('disable-scroll'); document.body.dataset.position = pagePosition; document.body.style.top = -pagePosition + 'px'; } enableScroll() { let pagePosition = parseInt(document.body.dataset.position, 10); this.unlockPadding(); document.body.style.top = 'auto'; document.body.classList.remove('disable-scroll'); window.scroll({ top: pagePosition, left: 0 }); document.body.removeAttribute('data-position'); } lockPadding() { let paddingOffset = window.innerWidth - document.body.offsetWidth + 'px'; this.fixBlocks.forEach((el) => { el.style.paddingRight = paddingOffset; }); document.body.style.paddingRight = paddingOffset; } unlockPadding() { this.fixBlocks.forEach((el) => { el.style.paddingRight = '0px'; }); document.body.style.paddingRight = '0px'; } } const modal = new Modal({ isOpen: (modal) => { console.log(modal); console.log('opened'); }, isClose: () => { console.log('closed'); }, });  
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy