Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 对随页面增长和收缩的文本和图像使用CSS_Jquery_Html_Css - Fatal编程技术网

Jquery 对随页面增长和收缩的文本和图像使用CSS

Jquery 对随页面增长和收缩的文本和图像使用CSS,jquery,html,css,Jquery,Html,Css,理想情况下,文本和图像(底部的按钮除外)会随着页面大小的调整而增长/收缩,并保持对齐,但随后会停止收缩到原始大小的某个百分比。比如说30%。我愿意使用CSS或jQuery,或者两者兼而有之 最好/最干净的方法是什么 请参见我的代码: 或: HTML: 自从Twitter以来,Twitter发生的最好的事情 超过1000万用户!免费获取推特播音员: © CSS: html、body、div、span、applet、object、iframe、h1、h2、h3、h4、h5

理想情况下,文本和图像(底部的按钮除外)会随着页面大小的调整而增长/收缩,并保持对齐,但随后会停止收缩到原始大小的某个百分比。比如说30%。我愿意使用CSS或jQuery,或者两者兼而有之

最好/最干净的方法是什么

请参见我的代码:

或:

HTML:


自从Twitter以来,Twitter发生的最好的事情
超过1000万用户!免费获取推特播音员:
©
CSS:

html、body、div、span、applet、object、iframe、h1、h2、h3、h4、h5、h6、p、blockquote、pre、a、abbr、首字母缩写、address、big、cite、code、del、dfn、em、img、ins、kbd、q、s、samp、small、strike、strong、sub、sup、tt、var、b、u、i、center、dl、dt、dd、ol、ul、li、fieldset、表单、标签、图例、表格、标题、tbody、tfoot、thead、tr、th、td、,文章、旁白、画布、细节、嵌入、图形、figcaption、页脚、页眉、hgroup、菜单、导航、输出、ruby、部分、摘要、时间、标记、音频、视频{
保证金:0;
填充:0;
边界:0;
垂直对齐:基线;
}
身体{
背景:#7bc5ef url(https://qa.tweetcaster.com/assets/img/layout/bg.jpg)中心-顶部重复-x;
垫面:15%;
字体系列:Helvetica、Arial、无衬线字体;
}
梅因先生{
浮动:左;
顶部:0px;
左边距:0;
宽度:550px;
}
.包装纸{
文本对齐:居中;
身高:100%;
位置:相对位置;
左边距:自动;
右边距:自动;
宽度:800px;
}
.标志{
保证金:30px 0px 0px;
}
.标语{
字体大小:40px;
颜色:#ffffff;
文本阴影:0px2px2pRGBA(0,0,0,10);
字号:700;
宽度:510px;
左边距:自动;
右边距:自动;
}
.页脚{
底部:0px;
宽度:550px;
左:0px;
利润率最高:30%;
垫底:20px;
}
.下载{
填充顶部:0px;
文本对齐:居中;
颜色:#000000;
字体大小:22px;
边缘底部:10px;
字号:700;
}
.链接{
文本对齐:居中;
字体大小:14px;
}
.链接a{
右侧填充:5px;
颜色:#282828 ;;
文字装饰:无;
}
.链接a:悬停{
文字装饰:下划线;
}
.反馈{
字号:700;
右边填充:10px;
}
李先生{
显示:内联块;
显示:内联;/*ie7修复*/
右侧填充:7px;
}
.设备{
左边距:15px;
显示:块;
边缘底部:30px;
}
.其他设备{
显示:块;
利润率:0.5px;
}
.其他设备{
显示:内联块;
显示:内联;/*ie7修复*/
右边填充:6px;
}
伯德先生{
浮动:对;
最大宽度:100%;
高度:自动;
宽度:自动\9;/*ie8*/
浮动:对;
底部:0;
位置:固定;
z指数:-10;
_位置:绝对位置;
_top:表达式(eval(document.documentElement.scrollTop+(document.documentElement.clientHeight this.offsetHeight));
身高:80%;
左边缘:-4%;
最小高度:400px;
最小宽度:181px;
}
.菜单按钮{
背景:无;
边界:无;
左边距:-7px;
光标:指针;
}
.隐藏菜单{
背景色:白色;
颜色:#000;
高度:328px;
位置:绝对位置;
显示:无;
边际上限:0px;
宽度:480px;
边框:1px实心#999999;
左:40px;
顶部:89px;
盒影:0 2px 9px rgba(0,0,0,75);
}
.获得{
颜色:#22222;
字体大小:20px;
文本对齐:居中;
边缘顶部:36px;
边缘底部:14px;
}
阿罗先生{
位置:绝对位置;
左边距:420px;
利润上限:3倍;
}
.tc_粉红色{
填充顶部:6px;
边缘底部:20px;
}
.获得{
边缘底部:10px;
}
.windows_按钮{
边界半径:7px;
}
.clear:之前,.clear:之后{
内容:“.”;
显示:块!重要;
身高:0;
溢出:隐藏;
}
.清楚:之后{
明确:两者皆有;
}
.清楚{
缩放:1;
}/*IE<8*/
p{
边缘底部:18px;
}
p:第一个孩子{
边缘底部:18px;
}
h1{
字体大小:20px;
线高:26px;
字体大小:正常;
}
表,p,h1,h2,h3,h4,标题{
颜色:#888;
}
​

根据浏览器和/或设备大小,利用CSS3媒体查询调整页面大小。 这里有一篇很棒的文章可以让您开始:

至于图像,如果您设置了一个具有页面宽度百分比的容器,您可以将以下内容添加到页面css中,使其具有响应性,并根据窗口大小调整大小

img {
    max-width: 100%;
    height: auto;
}
这将使页面上的图像在不使用媒体查询的情况下调整大小,但如果您想为每个浏览器/设备大小寻找更适合的自定义设置,您肯定希望使用媒体查询


希望这有帮助

我个人的观点是,你应该考虑使用HTML5/CSS3,你会发现它很容易为可调整大小的内容进行优化。您可以使用媒体查询来确定用于查看网站的分辨率,并且可以根据每个查询进行不同的指示。对我来说,这听起来像是响应性设计。这是一个巨大的资源列表,
    html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    vertical-align: baseline;
}
body {
    background: #7bc5ef url(https://qa.tweetcaster.com/assets/img/layout/bg.jpg) center top repeat-x;
    padding-top: 15%;
    font-family: Helvetica, Arial, sans-serif;
}
.main {
    float: left;
    top: 0px;
    margin-left: 0;
    width: 550px;
}
.wrapper {
    text-align: center;
    height: 100%;
    position: relative;
    margin-left: auto;
    margin-right: auto;
    width: 800px;
}
.logo {
    margin: 30px 0px 0px;
}
.tagline {
    font-size: 40px;
    color: #ffffff;
    text-shadow: 0px 2px 2px rgba(0,0,0, 10);
    font-weight: 700;
    width: 510px;
    margin-left: auto;
    margin-right: auto;
}
.footer {
    bottom: 0px;
    width: 550px;
    left: 0px;
    margin-top: 30%;
    padding-bottom: 20px;
}
.download {
    padding-top: 0px;
    text-align: center;
    color: #000000;
    font-size: 22px;
    margin-bottom: 10px;
    font-weight: 700;
}
.links {
    text-align: center;
    font-size: 14px;
}
.links a {
    padding-right: 5px;
    color: #282828;
    text-decoration: none;
}
.links a:hover {
    text-decoration: underline;
}
.feedback {
    font-weight: 700;
    padding-right: 10px;
}
.devices li {
    display: inline-block;
    display: inline; /*ie7 fix */
    padding-right: 7px;
}
.devices {
    margin-left: 15px;
    display: block;
    margin-bottom: 30px;
}
.other_devices {
    display: block;
    margin: 0 0 0 5px;
}
.other_devices li {
    display: inline-block;
    display: inline; /*ie7 fix */
    padding-right: 6px;
}
.bird img {
    float: right;
    max-width: 100%;
    height: auto;
    width: auto\9; /* ie8 */
    float: right;
    bottom: 0;
    position: fixed;
    z-index: -10;
    _position: absolute;
    _top:expression(eval(document.documentElement.scrollTop+ (document.documentElement.clientHeight-this.offsetHeight)));
    height: 80%;
    margin-left: -4%;
    min-height: 400px;
    min-width: 181px;
}
.menu_button {
    background: none;
    border: none;
    margin-left: -7px;
    cursor: pointer;
}
.hidden_menu {
    background-color: white;
    color: #000;
    height: 328px;
    position: absolute;
    display: none;
    margin-top: 0px;
    width: 480px;
    border: 1px solid #999999;
    left: 40px;
    top: 89px;
    box-shadow: 0 2px 9px rgba(0, 0, 0, .75);
}
 .get_tc {
    color: #222222;
    font-size: 20px;
    text-align: center;
    margin-top: 36px;
    margin-bottom: 14px;
}
.dd_arrow {
    position: absolute;
    margin-left: 420px;
    margin-top: 3px;
}
.tc_pink {
    padding-top: 6px;
    margin-bottom: 20px;
}
.get_tc {
    margin-bottom: 10px;
}
.windows_button {
    border-radius: 7px;
}
.clear:before, .clear:after {
    content: ".";
    display: block !important;
    height: 0;
    overflow: hidden;
}
.clear:after {
    clear: both;
}
.clear {
    zoom: 1;
} /* IE < 8 */
p {
    margin-bottom: 18px;
}
p:first-child {
    margin-bottom: 18px;
}
h1 {
    font-size: 20px;
    line-height: 26px;
    font-weight: normal;
}
table, p, h1, h2, h3, h4, caption {
    color: #888;
}
​
img {
    max-width: 100%;
    height: auto;
}