이미지, 일부 텍스트 및 기타 링크가 포함 된 전체 요소를 포함하도록 앵커 태그를 블록으로 표시하려고합니다. 현재로서는 앵커 태그를 배치 할 올바른 방법을 찾으려고 노력 중이므로 래핑 할 내용이 없어도 빈 태그가 표시되지 않지만 여전히 다른 링크를 포함하지 않고 텍스트를 배치합니다.의미 적으로 요소를 덮기 위해 앵커 태그를 배치하는 올바른 방법
H2 요소를 감싸는 등의 다양한 방법을 시도했습니다. 위치가 다르므로 결과가 엉망이며 이미지를 덮지 않으므로 작동하지 않습니다. (내용 요소가 다른 링크를 포함하고 있기 때문에 의미 적으로 부정확하고, 잘못 렌더링 된 앵커 태그가 너무 많았습니다), 내용 요소 안에 비어있게되었습니다 (전체 이미지를 그대로 커버하지 않기 때문에 작동하지 않습니다. 직접 자식이 아님) 콘텐츠 요소 외부에 비워 두었습니다 (제목과 설명이 앵커 태그가 아니기 때문에 잘 작동하지 않으므로 클릭 할 수 없습니다).
내가 지금 생각해내는 해결책은 내용 래퍼를 삭제하고 텍스트 및 기타 링크와 함께 빈 앵커 태그를 .entry 하위로 직접 배치하는 것이지만 텍스트가 올바르게 정렬되지 않도록하고 호버 효과의 스타일을 지정하는 데 사용한 : : before : and : after 요소의 높이가 현재 그대로 콘텐츠에 제한되지 않습니다. 나는 또한 콘텐츠 래퍼 외부의 다른 링크를 앵커와 동일한 부모 아래에 배치하도록 이동하려고 시도했지만 위치 지정에 대해서는 전혀 알지 못합니다.
JSFIDDLE : https://jsfiddle.net/qbppubbx/6/
HTML :
<ul>
<!--ditambahkan deskripsi, tapi berat. animasinya pakai css3, saya gagal jquery orz-->
<li class="opinion wrapper">
<div class="opinion container">
<div class="entry entry-1" style="background-image:url(img/contohgambar.jpg);">
<a href="" title="" class="article link"></a>
<div class="opinion content">
<h2 class="title">I have here two pledges that I shall yet slay Moby Dick and survive it. </h2>
<span class="details">
<a href="/test" title="" class="author">Nama Penulis</a>/
<a href="/date" title="" class="date ">Tanggal Penulisan</a>
</span>
<p class="description hide-text">
Both were silent again, as one man. The grey dawn came on, and the slumbering crew arose from the boat's bottom, and ere noon the dead whale was brought to the ship.
</p>
</div>
</div>
</div>
</li>
</ul>
CSS : 도움을
.wrapper {
float: left;
margin:0 0 0 0;
padding: 0 0 0 0;
box-sizing: border-box;
}
.container {
position: relative;
height: inherit;
overflow: hidden;
}
.opinion.container {
margin: 15px;
}
.entry {
height: inherit;
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
}
.entry .content {
position: absolute;
bottom: 20px;
left: 20px;
right: 20px;
text-align: left;
}
.entry > .article.link {
display: block;
position: absolute;
height: 100%;
width: 100%;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 2;
}
.content .title,
.content .details {
background-color: #000;
color: #fff;
display: inline;
position: relative;
}
.content .title {
font-family: "Patua One", "Georgia", serif;
font-size: 40px;
font-size: 2.2222rem;
}
.content .details {
font-family: "Roboto Condensed", "Arial Narrow", sans-serif;
font-size: 18px;
font-size: 1rem;
z-index: 3;
}
.content .details > a {
color: #505eea;
}
.content .details:before,
.content .description:before {
content: "";
display: block;
margin-top: 10px;
}
.content .description {
font-family: "Roboto", "Arial", sans-serif;
font-size: 14px;
font-size: 0.7778rem;
font-style: italic;
color: #f1f1f1;
opacity: 0;
position: relative;
width: 95%;
z-index: 1;
line-height: 1.5;
}
.opinion.content:before,
.opinion.content:after{
position: absolute;
content: "";
width: 0;
opacity: 0;
z-index: 0;
}
.opinion.content:before {
top: -10px;
right: 10px;
height: 110%;
background: #000;
}
.opinion.content:after {
border: 3px solid #ffe400;
bottom: 0;
height: 105%;
right: 0px;
background: transparent;
}
.hide-text {
height: 0;
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}
.opinion.container:hover .content .title,
.opinion.container:hover .content .details {
background-color: transparent;
}
.opinion.container:hover .content .title {
color: #505eea;
}
.content .details > a:hover {
color: #fff;
}
.opinion.container:hover .content .title,
.details a:hover {
transition: 0.25s ease-in-out;
}
.opinion.container:hover .opinion.content:before {
opacity: 0.9;
}
.opinion.container:hover .opinion.content:after,
.opinion.container:hover .content .description {
height: 100%;
opacity: 1;
}
.opinion.container:hover .opinion.content:after {
}
/*timing animasi*/
.opinion.content,
.opinion.content:before,
.opinion.content:after,
.opinion.container:hover .content .title,
.details a:hover,
.opinion.container:hover .content .description,
.opinion.container:hover .opinion.content:before,
.opinion.container:hover .opinion.content:after {
-webkit-transition: opacity 0.35s, -webkit-transform 0.35s;
transition: opacity 0.35s, transform 0.35s;
}
/*efek geser dari kiri ke kanan*/
/*initializing*/
.opinion.content:before,
.opinion.content:after {
-webkit-transform: translate3d(-100%,0,0);
transform: translate3d(-100%,0,0);
}
/*on hover*/
.opinion.container:hover .opinion.content:before,
.opinion.container:hover .opinion.content:after {
width: 115%;
-webkit-transform: translate3d(0,0,0);
transform: translate3d(0,0,0);
}
/*efek geser dari atas ke bawah*/
/*initializing*/
.opinion.content {
-webkit-transform: translate3d(0,0,0);
transform: translate3d(0,0,0);
}
/*on hover*/
.opinion.container:hover .opinion.content {
-webkit-transform: translate3d(0,-20px,0);
transform: translate3d(0,-20px,0);
}
@media (min-width: 1280px) {
.home.container {
max-width: 1200px;
}
.wrapper {
height: 618px;
}
.opinion.card.container:hover .opinion.card.description {
width: 90%;
}
.wrapper {
display: inline-block;
width: 33.3333333%;
}
.opinion.wrapper:first-child {
width: 66.66666666666%;
}
}
감사합니다!
EDIT : 다른 해결책은 다른 앵커 태그를 만들고 각 요소를 .entry 요소와 텍스트 래퍼 (.content)에 배치하는 것입니다. 그렇게하면 이미지와 텍스트가 모두 포함됩니다. 나는 원래 같은 앵커 태그가 두 번 언급되거나 사용된다는 것을 의미하기 때문에 원래이 방법을 사용하고 싶지는 않습니다. 의미 상 정확할 지 여부는 확실하지 않습니다. 현재로서는 다른 제안이 오기를 기다리고 있습니다.
JSFIDDLE : https://jsfiddle.net/wq6tje6g/1/
나는 앵커 태그 안에 모든 내용을 넣으므로 이해하지 못했다. 클릭 할 때마다 리디렉션 할 수있다. –
@ARUN : 전체 요소 나 내용 (텍스트 래퍼) 내부 요소? 또한 링크가 포함되어 있으며, 다른 앵커 태그가 포함 된 래퍼 주위에 앵커 태그를 래핑하는 것이 괜찮은지 여부는 확실하지 않습니다. –
아니요, 링크를 링크에 넣을 수는 없지만 내부 링크를 덮어 쓰면 처음에는 링크가 많지 않습니다. 당신이하려는 일이 정말로 명확하지 않습니다. 이 콘텐츠를 다루는 링크가 필요한 이유가 무엇입니까? –