gpt4 book ai didi

css - 日期框的子主题 CSS 修复

转载 作者:行者123 更新时间:2023-11-28 11:39:18 24 4
gpt4 key购买 nike

因为上次的帮助很棒,我会再次试试运气..

所以我正在构建一个定制的 Wordpress 主题,但我被困在一个特定的 CSS 相关“功能”上。

我试图在每个帖子旁边的主要内容“表格”之外添加一个日期框,就像这里的 Bouquet 主题一样:http://wp-themes.com/bouquet/

我注意到它主要是 entry-header 完成所有工作所以我几乎从 bouquet 中获取了 CSS 代码,玩了一下,修改了函数以包含 entry-header div 但它看起来仍然像-.-"..

因为我目前正在本地服务器上离线处理主题,所以我可以向您展示它的打印屏幕:hxp://s24.postimg.org/cows6mvdh/fix_this.png 或此处的整页:http://oi39.tinypic.com/11j7ptz.jpg

根据我的理解,它似乎忽略了页面的最大宽度,而是使用了整个页面宽度,这就是为什么这样显示日期的原因:/

这是我的 CSS(我还在学习,所以请多关照 tyvm):

    /* =Reset
-------------------------------------------------------------- */

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, font, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
border: 0;
font-family: inherit;
font-size: 100%;
font-style: inherit;
font-weight: inherit;
margin: 0;
outline: 0;
padding: 0;
vertical-align: baseline;
}
html {
font-size: 62.5%; /* Corrects text resizing oddly in IE6/7 when body font-size is set using em units http://clagnut.com/blog/348/#c790 */
overflow-y: scroll; /* Keeps page centred in all browsers regardless of content height */
-webkit-text-size-adjust: 100%; /* Prevents iOS text size adjust after orientation change, without disabling user zoom */
-ms-text-size-adjust: 100%; /* www.456bereastreet.com/archive/201012/controlling_text_size_in_safari_for_ios_without_disabling_user_zoom/ */
}
body {
background: #fff;
}
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
nav,
section {
display: block;
}
ol, ul {
list-style: none;
}
table { /* tables still need 'cellspacing="0"' in the markup */
border-collapse: separate;
border-spacing: 0;
}
caption, th, td {
font-weight: normal;
text-align: left;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: "";
}
blockquote, q {
quotes: "" "";
}
a:focus {
outline: thin dotted;
}
a:hover,
a:active { /* Improves readability when focused and also mouse hovered in all browsers people.opera.com/patrickl/experiments/keyboard/test */
outline: 0;
}
a img {
border: 0;
}


/* =Global
----------------------------------------------- */

body,
button,
input,
select,
textarea {
color: #6b6252;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 14px;
font-size: 1.4rem;
line-height: 1.5;
}

body {
background: #FAFAFA;
}

/* Headings */
h1,h2,h3,h4,h5,h6 {
clear: both;
margin: 0.6em 0;
}
h1 {
font-size: 36px;
font-size: 3.6rem;
}
h2 {
font-size: 28px;
font-size: 2.8rem;
}
h3 {
font-size: 22px;
font-size: 2.2rem;
}
h4 {
font-size: 16px;
font-size: 1.6rem;
}
h5 {
font-size: 14px;
font-size: 1.4rem;
}
h6 {
font-size: 12px;
font-size: 1.2rem;
}
hr {
background-color: #ccc;
border: 0;
height: 1px;
margin-bottom: 1.5em;
}

/* Text elements */
p {
margin-bottom: 1.5em;
}
ul, ol {
margin: 0 0 1.5em 3em;
}
ul {
list-style: disc;
}
ol {
list-style: decimal;
}
ul ul, ol ol, ul ol, ol ul {
margin-bottom: 0;
margin-left: 1.5em;
}
dt {
font-weight: bold;
}
dd {
margin: 0 1.5em 1.5em;
}
b, strong {
font-weight: bold;
}
dfn, cite, em, i {
font-style: italic;
}
blockquote {
font-style: italic;
margin: 0 1.5em;
}
address {
margin: 0 0 1.5em;
}
pre {
background: #dfd6c7;
font-family: "Courier 10 Pitch", Courier, monospace;
font-size: 15px;
font-size: 1.5rem;
line-height: 1.6;
margin-bottom: 1.6em;
padding: 1.6em;
overflow: auto;
max-width: 100%;
}
code, kbd, tt, var {
font: 15px Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace;
}
abbr, acronym {
border-bottom: 1px dotted #666;
cursor: help;
}
mark, ins {
background: #fff9c0;
text-decoration: none;
}
sup,
sub {
font-size: 75%;
height: 0;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
bottom: 1ex;
}
sub {
top: .5ex;
}
small {
font-size: 75%;
}
big {
font-size: 125%;
}
figure {
margin: 0;
}
table {
margin: 0 0 1.5em;
width: 100%;
}
th {
font-weight: bold;
}
button,
input,
select,
textarea {
font-size: 100%; /* Corrects font size not being inherited in all browsers */
margin: 0; /* Addresses margins set differently in IE6/7, F3/4, S5, Chrome */
vertical-align: baseline; /* Improves appearance and consistency in all browsers */
*vertical-align: middle; /* Improves appearance and consistency in all browsers */
}
button,
input {
line-height: normal; /* Addresses FF3/4 setting line-height using !important in the UA stylesheet */
*overflow: visible; /* Corrects inner spacing displayed oddly in IE6/7 */
}
button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
border: 1px solid #ccc;
border-color: #ccc #ccc #bbb #ccc;
border-radius: 3px;
background: #e6e6e6;
-webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), inset 0 15px 17px rgba(255,255,255,0.5), inset 0 -5px 12px rgba(0,0,0,0.05);
-moz-box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), inset 0 15px 17px rgba(255,255,255,0.5), inset 0 -5px 12px rgba(0,0,0,0.05);
box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), inset 0 15px 17px rgba(255,255,255,0.5), inset 0 -5px 12px rgba(0,0,0,0.05);
color: rgba(0,0,0,.8);
cursor: pointer; /* Improves usability and consistency of cursor style between image-type 'input' and others */
-webkit-appearance: button; /* Corrects inability to style clickable 'input' types in iOS */
font-size: 12px;
font-size: 1.4rem;
line-height: 1;
padding: 1.12em 1.5em 1em;
text-shadow: 0 1px 0 rgba(255,255,255,.8);
}
button:hover,
html input[type="button"]:hover,
input[type="reset"]:hover,
input[type="submit"]:hover {
border-color: #ccc #bbb #aaa #bbb;
-webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), inset 0 15px 17px rgba(255,255,255,0.8), inset 0 -5px 12px rgba(0,0,0,0.02);
-moz-box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), inset 0 15px 17px rgba(255,255,255,0.8), inset 0 -5px 12px rgba(0,0,0,0.02);
box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), inset 0 15px 17px rgba(255,255,255,0.8), inset 0 -5px 12px rgba(0,0,0,0.02);
}
button:focus,
html input[type="button"]:focus,
input[type="reset"]:focus,
input[type="submit"]:focus,
button:active,
html input[type="button"]:active,
input[type="reset"]:active,
input[type="submit"]:active {
border-color: #aaa #bbb #bbb #bbb;
-webkit-box-shadow: inset 0 -1px 0 rgba(255,255,255,0.5), inset 0 2px 5px rgba(0,0,0,0.15);
-moz-box-shadow: inset 0 -1px 0 rgba(255,255,255,0.5), inset 0 2px 5px rgba(0,0,0,0.15);
box-shadow: inset 0 -1px 0 rgba(255,255,255,0.5), inset 0 2px 5px rgba(0,0,0,0.15);
}
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box; /* Addresses box sizing set to content-box in IE8/9 */
padding: 0; /* Addresses excess padding in IE8/9 */
}
input[type="search"] {
-webkit-appearance: textfield; /* Addresses appearance set to searchfield in S5, Chrome */
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box; /* Addresses box sizing set to border-box in S5, Chrome (include -moz to future-proof) */
box-sizing: content-box;
}
input[type="search"]::-webkit-search-decoration { /* Corrects inner padding displayed oddly in S5, Chrome on OSX */
-webkit-appearance: none;
}
button::-moz-focus-inner,
input::-moz-focus-inner { /* Corrects inner padding and border displayed oddly in FF3/4 www.sitepen.com/blog/2008/05/14/the-devils-in-the-details-fixing-dojos-toolbar-buttons/ */
border: 0;
padding: 0;
}
input[type=text],
input[type=email],
textarea {
background: rgba( 255, 255, 255, 0.3 );
border: 1px solid #ccc;
border-radius: 3px;
padding: 6px;
}
input[type=text]:focus,
input[type=email]:focus,
textarea:focus {
background: #fff;
}
textarea {
overflow: auto; /* Removes default vertical scrollbar in IE6/7/8/9 */
padding-left: 3px;
vertical-align: top; /* Improves readability and alignment in all browsers */
width: 98%;
}

/* Links */
/*a,
a:visited {
color: #748a81;
text-decoration: none;
transition: all .3s ease-in-out;
-webkit-transition: all .3s ease-in-out;
-moz-transition: all .3s ease-in-out;
}
a:hover,
a:focus,
a:active {
color: #33605a;
}*/

a {
color:#1c9bdc;
text-decoration: none;
}
a:focus,
a:active,
a:hover {
color: #1873a1;
text-decoration: underline;
}

/* Alignment */
.alignleft {
display: inline;
float: left;
margin-right: 1.5em;
margin-bottom: 1em;
}
.alignright {
display: inline;
float: right;
margin-left: 1.5em;
margin-bottom: 1em;
}
.aligncenter {
clear: both;
display: block;
margin: 1.5em auto;
}

/* Text meant only for screen readers */
.assistive-text {
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
position: absolute !important;
}

.site-title,
.entry-title,
.page-title,
.entry-content,
.entry-summary,
.widget-title,
.comments-title,
.comment .reply,
.comment-meta,
.comment-author,
#reply-title {
font-family: Georgia, 'Times New Roman', serif;
}


/* =Structure
----------------------------------------------- */

#main,
.main-navigation,
.site-title,
.site-description {
margin: 0 auto;
max-width: 1180px;
box-shadow: 0 0 20px #9F9F9F;
}
#main {
clear: both;
overflow: hidden;
}
#primary {
float: left;
margin: 0 -27% 0 0;
padding: 2em;
width: 88%;
}
#content {
margin: 0 23% 0 0;
}
#secondary,
#tertiary {
background: #FFFFFF;
float: right;
margin: 1em 1em 0;
padding: 0.5em 0.8em 0;
position: relative;
width: 22%;
word-wrap: break-word;
}
#tertiary {
padding-top: 0;
}
.site-footer {
clear: both;
width: 100%;
}


/* =Site Header
----------------------------------------------- */

.site-header hgroup {
background: #FAFAFA;
padding: 1.5em 2em;
text-align: center
}
.site-title {
font-size: 45px;
font-size: 4.5rem;
font-style: italic;
}
.site-description {
font-size: 13px;
font-size: 1.3rem;
}
.site-title a,
.site-description {
color: #2E2E2E;
}


/* =Menu
----------------------------------------------- */

.main-navigation {
clear: both;
display: block;
padding: 1.5em;
}
.main-navigation:after {
clear: both;
content: "";
display: block;
}
.main-navigation ul {
list-style: none;
margin: 0;
padding-left: 0;
}
.main-navigation li {
float: left;
margin: 0.5em 0;
position: relative;
}
.main-navigation a {
color: #7c948a;
display: block;
font-size: 1.4rem;
font-weight: bold;
margin-right: 2em;
text-decoration: none;
}
.main-navigation ul ul {
background: #FAFAFA;
border: 1px solid rgba( 0, 0, 0, 0.1 );
display: none;
float: left;
position: absolute;
top: 1.2em;
left: 0;
z-index: 99999;
}
.main-navigation ul ul ul {
left: 100%;
top: 0;
}
.main-navigation ul ul a {
padding: 0 1.5em;
width: 200px;
}
.main-navigation ul ul li {
}
.main-navigation li:hover > a,
.main-navigation li.current_page_item a,
.main-navigation li.current-menu-item a,
.main-navigation ul ul a:hover {
color: #33605a;
}
.main-navigation ul ul :hover > a {
}
.main-navigation ul li:hover > ul {
display: block;
}

/* Small menu */
.menu-toggle {
color: #7c948a;
cursor: pointer;
font-size: 20px;
font-weight: bold;
text-align: center;
}
.main-small-navigation .menu {
display: none;
}


/* =Content
----------------------------------------------- */

.site-main {
background: #FFFFFF;
border: 1px solid rgba(0, 0, 0, 0.1);
border-width: 3px 1px;
}
.sticky {
}
.hentry {
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
margin: 0 0 1.5em;
padding-bottom: 1.5em;
}
.entry-title,
.page-title {
font-size: 28px;
font-size: 2.8rem;
font-style: italic;
margin: 0 0 0.2em;
}
.entry-title a {
text-decoration: none;
}

.entry-header {
padding: 0.6em 0;
}
.entry-date {
background: #f8e3ea;
border: 5px solid #fff;
border-right-width: 0;
border-radius: 10px 0 0 10px;
padding: .2em 0;
position: absolute;
left: -1em;
line-height: 3.1em;
text-align: center;
height: 55px;
width: 50px;
}
.entry-date a {
color: #63724b;
display: block;
font-family: 'Sorts Mill Goudy', 'Times New Roman', serif;
margin-top: -6px;
}
.entry-date a:hover {
text-decoration: none;
}
.entry-date b {
display: block;
font-size: 28px;
font-weight: bold;
line-height: 0;
}


body.search .page-title,
body.archive .page-title {
font-size: 16px;
font-size: 1.6rem;
margin-bottom: 1em;
}
.entry-meta {
clear: both;
font-size: 12px;
font-size: 1.2rem;
}
.byline {
display: none;
}
.single .byline,
.group-blog .byline {
display: inline;
}
.entry-content,
.entry-summary {
margin: 1.5em 0 0;
}
.entry-content table,
.comment-content table {
border: 1px solid #d9d9d9;
border-left-width: 0;
margin: 0 -0.083em 2.083em 0;
text-align: left;
width: 100%;
}
.entry-content tr th,
.entry-content thead th,
.comment-content tr th,
.comment-content thead th {
border-left: 1px solid #d9d9d9;
font-weight: bold;
padding: 0.5em 1.25em;
}
.entry-content tr td,
.comment-content tr td {
border: 1px solid #d9d9d9;
border-width: 1px 0 0 1px;
padding: 0.5em 1.25em;
}
.entry-content tr.odd td,
.comment-content tr.odd td {
background: #dfd6c7;
}
.page-links {
clear: both;
margin: 0 0 1.5em;
}


/* =Aside Post Format
----------------------------------------------- */

.format-aside .entry-content {
border-left: 4px solid rgba( 0, 0, 0, 0.1 );
padding-left: 1em;
}


/* =Media
----------------------------------------------- */

.site-header img,
.entry-content img,
.comment-content img,
.widget img {
max-width: 100%; /* Fluid images for posts, comments, and widgets */
}
.site-header img,
.entry-content img,
.widget-img,
img[class*="align"],
img[class*="wp-image-"],
.wp-caption img {
height: auto; /* Make sure images with WordPress-added height and width attributes are scaled correctly */
}
.site-header img,
.entry-content img,
.widget img,
img.size-full {
max-width: 100%;
width: auto; /* Prevent stretching of full-size images with height and width attributes in IE8 */
}
.entry-content img.wp-smiley,
.comment-content img.wp-smiley {
border: none;
margin-bottom: 0;
margin-top: 0;
padding: 0;
}
.wp-caption {
border: 1px solid #ccc;
max-width: 100%;
}
.wp-caption.aligncenter,
.wp-caption.alignleft,
.wp-caption.alignright,
.wp-caption.alignnone {
margin-bottom: 1.5em;
}
.wp-caption img {
display: block;
margin: 1.2% auto 0;
max-width: 98%;
}
.wp-caption-text {
text-align: center;
}
.wp-caption .wp-caption-text {
margin: 0.8075em 0;
}
#content .gallery {
margin-bottom: 1.5em;
}
.wp-caption-text,
.gallery-caption {
font-size: 12px;
font-size: 1.2rem;
font-style: italic;
}
#content .gallery a img {
border: none;
height: auto;
max-width: 90%;
}
#content .gallery dd {
margin: 0;
}

/* Make sure embeds and iframes fit their containers */
embed,
iframe,
object {
max-width: 100%;
}


/* =Navigation
----------------------------------------------- */

.site-content .site-navigation {
font-size: 13px;
font-size: 1.3rem;
font-style: italic;
margin: 0 0 1.5em;
overflow: hidden;
}
.site-content .nav-previous {
float: left;
width: 50%;
}
.site-content .nav-next {
float: right;
text-align: right;
width: 50%;
}

/* =Comments
----------------------------------------------- */

#comments {
clear: both;
}
.bypostauthor {
}
.comments-title,
#reply-title {
font-size: 20px;
font-size: 2rem;
}
.commentlist li {
list-style: none;
}
.commentlist,
.children {
list-style: none;
margin: 0;
}
.children {
margin: 0 0 0 6%;
}
.commentlist li.comment,
.commentlist li.pingback {
border-bottom: 1px solid rgba( 0, 0, 0, 0.2 );
padding-left: 2.5em;
}
.commentlist .children li,
.commentlist li:last-of-type {
border: none;
}
article.comment,
li.pingback {
overflow: hidden;
padding: 2.5em 0 0.7em;
position: relative;
}
.children article.comment,
.children li.pingback {
padding-top: 1.0em;
}
.comment .avatar {
float: left;
margin-right: 1.25em;
}
.comment-author {
font-size: 14px;
font-size: 1.4rem;
}
.comment-meta {
font-size: 12px;
font-size: 1.2rem;
}
.comment-content{
font-size: 13px;
font-size: 1.3rem;
margin: 1em 0 0 4.5em;
}
.comment .reply {
font-size: 12px;
font-size: 1.2rem;
text-align: right;
}
li.pingback {
font-weight: bold;
}
li.pingback a {
font-weight: normal;
}

/* Comment Form */
.comment-notes,
#commentform .form-allowed-tags,
p.nocomments,
p.logged-in-as,
#commentform label {
font-size: 13px;
font-size: 1.3rem;
}
.required {
color: #880000;
}
#commentform label {
font-weight: bold;
padding: 1em 0;
}
#commentform input[type="text"] {
margin-left: 0.5em;
}
#commentform #comment {
margin-top: 0.6em;
}
#commentform .form-allowed-tags,
#commentform .form-allowed-tags code {
font-size: 11px;
font-size: 1.1rem;
}
p.nocomments {
margin: 2.5em;
}


/* =Widgets
----------------------------------------------- */

.widget {
font-size: 12px;
font-size: 1.2rem;
line-height: 1.8;
margin: 0 0 1.5em;
}
.widget-title {
color: #999;
font-size: 20px;
font-size: 2rem;
font-style: italic;
}

/* Search widget */
#searchsubmit {
display: none;
}


/* =Site Footer
----------------------------------------------- */

.site-info {
font-size: 13px;
font-size: 1.3rem;
padding: 1.5em 0;
text-align: center;
}


/* =Responsive Structures
----------------------------------------------- */

@media only screen and (max-width: 800px) {

.entry-date {
border-radius: 0 10px 10px 0;
border-right-width: 5px;
border-left-width: 0;
height: 45px;
left: -1.3em;
z-index: 9999;
}
.entry-date a {
margin-top: -9.5px;
}
#main {
overflow: visible;
}
#content,
#primary,
#secondary,
#tertiary {
background: none;
float: none;
margin: 0;
padding: 0;
}
#primary,
#secondary,
#tertiary {
width: 100%;
}
.site-header hgroup,
#main {
padding: 0.8em;
}
}


/* =IE Styles
----------------------------------------------- */

#ie8 .site-header img,
#ie8 .entry-content img,
#ie8 img.size-full,
#ie8 .entry-thumbnail img,
#ie8 .widget img,
#ie8 .wp-caption img {
width: auto; /* Prevent stretching of full-size images with height and width attributes in IE8 */
}

结构:

    <div id="page" class="hfeed site">
<div id="main" class="site-main">
<header class="entry-header">
<div class="entry-date">date goes here</div>

如果您需要其他信息或者我遗漏了某些信息,请告诉我。

最佳答案

您可能想做这样的事情?

http://jsfiddle.net/7V2Uh/

在这里,我在文章 DOM 中创建了一个“日期”DOM。设置相对于 post DOM 的位置,将绝对位置设置为日期 DOM,并根据需要调整位置。

片段:

<div class="post">
<div class="date"></div>
This is just another article DIV.. we have date div inside it..
</div>

CSS:

.post{
position:relative;
margin-left:50px;
}

.date {
position : absolute;
top:10px;
left:-50px;
display:block;
width:50px;
height:50px;
background:#eee;
}

关于css - 日期框的子主题 CSS 修复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20760179/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com