2014-01-19 56 views
0

我的歉意我可能只是没有在我的搜索中使用正确的术语,因为我确信这已被回答了几千次。响应元素定位

所以我知道很多关于CSS和HTML的知识,但并不像我想的那么多。我所知道的大多数情况是针对固定(无响应)网站。虽然我确实知道一些响应像%而不是px,但在调整浏览器宽度以模拟3台显示器(移动平板电脑/笔记本电脑)时,我遇到了一个问题。

我有2个元素并排。桌面上一切都很好。那么当我缩小到Tablet和Mobile时,元素(艺术家姓名和社交链接)与左侧的艺术家图像重叠。除了菜单消失之外(如果你不介意,也会喜欢这方面的信息(Rebel Mouse Social也会在手机大小中消失))。

我该如何编码,以便将艺术家姓名和社交链接元素移至图片下方而不是重叠?

我最终只喜欢在DreamWeaver中工作,并且抛弃了Joomla,因为3年后它开始感觉很严格。

非常感谢您阅读本文,我非常感谢您(任何人)花时间阅读所有这些内容。

工作演示这里http://www.blackandyellowrecords.com/mca/jlegacy

CSS(containted的Joomla文章里面用HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"          

    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<style type="text/css"> 
<!-- 
body { 
    font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif; 
    background-color: #D6D6D6; 
    margin: 0; 
    padding: 0; 
    color: #000; 
} 
/* ~~ Element/tag selectors ~~ */ 
ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */ 
    padding: 0; 
    margin: 0; 
} 
h1, h2, h3, h4, h5, h6, p { 
    margin-top: 0; /* removing the top margin gets around an issue where margins can escape from their containing div. The remaining bottom margin will hold it away from any elements that follow. */ 
    padding-right: 15px; 
    padding-left: 15px; /* adding the padding to the sides of the elements within the divs, instead of the divs themselves, gets rid of any box model math. A nested div with side padding can also be used as an alternate method. */ 
    font-family: Ash; 
     color: 000; 
} 
a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */ 
    border: none; 
} 
/* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */ 
a:link { 
    color:#414958; 
    text-decoration: none; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */ 
} 
a:visited { 
    color: #4E5869; 
    text-decoration: none; 
} 
a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */ 
    text-decoration: none; 
} 
/* ~~ this container surrounds all other divs giving them their percentage-based width ~~ */ 
.artcontainer { 
     background-image: url('/images/icons/jlegheaderfade.png'); 
     background-repeat: no-repeat; 
     background-position: right top; 
    width: 100%; 
    background-color: #FFF; 
    margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout. It is not needed if you set the .container's width to 100%. */ 
} 
/* ~~ This is the layout information. ~~ 
1) Padding is only placed on the top and/or bottom of the div. The elements within this div have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the div itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the div and place a second div within it with no width and the padding necessary for your design. 
*/ 
.artcontent { 
    padding: 0 0; 
} 
/* ~~ This grouped selector gives the lists in the .content area space ~~ */ 
.artcontent ul, .artcontent ol { 
    padding: 0 0px 0px 0px; /* this padding mirrors the right padding in the headings and paragraph rule above. Padding was placed on the bottom for space between other elements on the lists and on the left to create the indention. These may be adjusted as you wish. */ 
} 
/* ~~ miscellaneous float/clear classes ~~ */ 
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */ 
    float: right; 
    margin-left: 8px; 
} 
.fltlft { /* this class can be used to float an element left in your page. The floated element must precede the element it should be next to on the page. */ 
    float: left; 
    margin-right: 8px; 
} 
.clearfloat { /* this class can be placed on a <br /> or empty div as the final element following the last floated div (within the #container) if the overflow:hidden on the .container is removed */ 
    clear:both; 
    height:0; 
    font-size: 1px; 
    line-height: 0px; 
} 

.artcontainer #artistpic{ 
     position: absolute; 
    top:0; 
    left:0; 
    float: left; 
     width: 90%; 
     height: auto; 
     z-index: 5; 
} 

.artistname{ 
    position:absolute; 
    text-align: center; 
    max-width: 400px; 
    line-height: .9; 
    float: left; 
    left: 65%; 
    top: 12%; 
} 
/*SOCIAL FEED*/ 
.rebel{ 
    float:none; 
    z-index:1; 
} 
/*SOCIAL ICONS*/ 
.sicons{ 
    position:absolute; 
    float: left; 
    left: 68%; 
    top: 14%; 
    font-size:10px; 
} 
/*SOCIAL ICON BLUR*/ 
.sicons img { 
    -webkit-transition: all 1s ease; 
    -moz-transition: all 1s ease; 
     -o-transition: all 1s ease; 
     -ms-transition: all 1s ease; 
      transition: all 1s ease; 
} 
/*HOVER BLUR*/ 
.sicons img:hover { 
    -webkit-filter: blur(5px); 
} 

.artistmenu{ 
    float:none; 
    position:absolute; 
    z-index:2; 
    top: 525px; 
    width: 99.9%; 
} 

--> 
</style> 

<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" /> 
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script> 
</head> 

HTML:

<body> 
<div class="artcontainer"> 
    <div class="artcontent"> 
    <div class="artistpic"> 
     <p><img src="/images/artists/jleg.png" alt="Jlegacy" width="459px"/></p> 
    </div> 
    <div class="artistname"> 
    <h1><strong>JLegacy</strong></h1> 
    </div> 
    <div class="sicons"><a href="http://www.twitter.com/jlegacydatruth" target="_blank"><img src="/images/icons/twitter.png" width="30px" height="30px"/></a> 
     <a href="https://www.facebook.com/JLegacysFinest" target="_blank"><img src="/images/icons/fb.png" width="30px" height="30px"/></a> 
     <a href="http://instagram.com/jlegacysfinest" target="_blank"><img src="/images/icons/insta.png" width="30px" height="30px"/></a> 
    </div> 
    <div class="artistmenu"> 
    <ul id="MenuBar1" class="MenuBarHorizontal"> 
      <li><a class="MenuBarItemSubmenu" href="#">Social</a></li> 
      <li><a href="#"> Streaming Music</a></li> 
      <li><a class="MenuBarItemSubmenu" href="#">Releases</a> 
      <ul> 
       <li><a class="MenuBarItemSubmenu" href="#">Albums</a></li> 
       <li><a href="#">Mixtapes</a></li> 
       <li><a href="#">Singles</a></li> 
      </ul> 
      </li> 
      <li><a href="#">Mailing List</a></li> 
    </ul> 
    </div> 
    <div class="rebel"> 
     <center> 
     <script type="text/javascript" class="rebelmouse-embed-script" src="https://www.rebelmouse.com/static/js-build/embed/embed.js?site=JLegacysFinest&height=1500&flexible=0&scrollbar_theme=light-2"></script> 
     </center> 
     </div> 
     <script type="text/javascript"> 
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"}); 
</script> 
    <!-- end .content --></div> 
    <!-- end .container --></div> 
</body> 
</html> 
+0

wowowo,还有2个para,这是一个TMH出版物的价值材料...做**谷歌媒体查询**队友......! :) – NoobEditor

+0

@NoobEditor大声笑喜欢你的评论 –

+0

大声笑谢谢,我喜欢写书哈哈。 – BDSmith

回答

0

你提到的要素的位置是:绝对的,所以通过改变顶部和左侧的值,你可以po将它们放在图像下

ex。

.artistname { 
    top: 92%; 
    left: 49%; 
} 

这不完全是响应式设计的要点,但它适用于您..当然,您需要媒体查询。

+0

WADR队友...媒体查询是他需要的....你所建议的将会在所有维度上得到全面应用! :) – NoobEditor

+0

这就是为什么我说'当然'..老兄:P – Naele

+1

Naele感谢您的回应我将与NoogEditor说Google和Google搜索一起测试。 谢谢大家,对于这本书感到抱歉:-p只是想要具体而不是不尊重询问。 – BDSmith