I'm working on a newsfeed and I have a while loop for every posts with the styles, but then I created an
<input type="submit" name="deletePost" value="Delete" class="delete_post" />
and with the styling it isn't working... well the styling works but the :hover isn't working. Nor the :active and others. Very strange.
CSS
.image_post .user_avatar {
width:32px;
height:32px;
overflow:hidden;
border-radius:50%;
}
.image_post .user_avatar img {
width:32px;
min-height:32px;
}
.image_post .user_name {
margin-top:7px;
color:#fc0096;
margin-left:-5px;
}
.image_post .timeago {
color:#999;
font-size:10px;
position:absolute;
top:10px;
right:10px;
}
.image_post img {
width:100%;
border:1px solid #ccc;
}
.image_description {
width:100%;
padding-bottom:8px;
background:white;
text-align:left;
color:#000;
margin-top:-10px;
}
.image_post input[type="submit"] {
border:0;
position:absolute;
top:30px;
right:10px;
background:black;
padding:0;
margin:6px 0 0 0;
color:#fff;
font-size:9px;
text-decoration:underline;
z-index:999;
}
.image_post input[type="submit"]:hover {
cursor:pointer !important;
}
HTML INSIDE PHP WHILE LOOP
<div class="image_post">
<input type="submit" name="deletePost" value="Delete" class="delete_post" />
<div class="user_avatar">
<img src="avatars/'.$pica['username'].'.jpeg" />
</div>
<div class="user_name">'.$pica['username'].'</div>
<br>
<br>
<br>
<br>
<div class="timeago">'.$diff.'</div>
<div class="image_description">'.$pica['description'].'</div>
<img src="upload/'.$pica['name'].'" />
<div class="clear"></div>
</div>
I really don't understand why the :hover isn't working. It does take the styles from the normal one, but then the :hover, :active etc isn't working. I'm struggling with this and it's really weird, because I do html/css for 2 years, every day. I tried a lot of possible solutions, but sadly... they failed. Even in pencode / jsfiddle it failed with the cursor:pointer ;/
Even tho it's weird... try using the class like .delete_post:hover on your CSS instead of input[type="submit"]:hover.
I think that should work fine. If not, try placing and ID for it and try with the ID like .image_post #delete_post:hover.
Since it's super weird because it should work fine... maybe you can try jQuery and do something like this:
$(document).ready(function(){
$(".delete_post").hover(function(){
$(this).attr("style","cursor:pointer;");
$(this).removeAttr("style");
});
});
But again... I don't see why :hover is not working for you.
Related
Im trying to do that: get 3 consecutives rows of a grid being "fixed;" but Im having problems that idk. Heres my code:
.main-container {
display:grid;
background-color:#e0e0e0;
grid-template-columns: 50% 50%;
box-sizing:border-box;
z-index:-1;
}
.main-container > * {
text-align:center;
display:flex;
justify-content:center;
align-items:center;
}
.main-container div {
color:black;
border: px solid black;
}
.main-container video {
display:block;
width:100%;
height:100%;
/* Scale video to container size */
object-fit: cover;
object-position: center;
z-index:10000;
}
.main-container h4 {
color:#edbd87;
}
.item1{
grid-column: 1 / 3;
background-color: green;
height:1080px;
}
.item2{
right:0;
left:0;
top:300px;
bottom:0;
position:absolute;
grid-column: 1 / 3;
display:inline-block;
z-index:1000000;
}
.item3{
background:#e0e0e0;
grid-column: 1 / 3;
height:40vh;
border-bottom:1px solid black;
}
.item4 {
padding:30px;
z-index:10;
width:100%;
height:800px;
}
.item4 img{
padding:15px;
justify-self:center;
display:block;
width:90%;
height:80%;
/* Scale video to container size */
object-fit: cover;
object-position: center;
border-radius: 80px 20px;
z-index:10;
}
.item5{
padding:40px;
width:100%;
display: inline;
z-index:9;
}
.item5 *{
padding:20px;
font-weight:bold;
font-size: 300%;
}
.item5 p{
margin-top:30px;
padding:40px;
font-weight:bold;
font-size: 180%;
}
.item5 h4{
margin-top:40px;
font-weight:bold;
font-size: 640%;
}
<?php get_header(); ?>
<div class="main-container">
<div class="item1">
<video id="vid" src="http://localhost/wordpress/wp-content/themes/twentytwentyone-child/img/coffee1.mp4" width="1920" height="1080" autoplay loop muted type="video/mp4"> </video>
</div>
<div class="item2">
<p style="font-size:50px; color:white;"> Join Us! </P>
<button type="button" class="btn btn-outline-warning" style="font-family:forum; font-weight:bold; background-color:transparent; border-radius: 3px; color:yellow; font-size:50px; border: 2px solid yellow;">Warning</button>
</div>
<div class="item3">
<img src="http://localhost/wordpress/wp-content/themes/twentytwentyone-child/img/logo.png" />
</div>
<div class="item4">
<img src="http://localhost/wordpress/wp-content/themes/twentytwentyone-child/img/arvan2.jpg" />
</div>
<div class="item5">
<h4>WHO WE ARE?</h4>
<p>
ArvanJobs is above all peace of mind. It is a new way
of working, of traveling, of training, of advancing in
your career. Whether you are a company looking for
workers or you are looking for a new job
opportunity, ArvanJobs will always be by your side,
selecting the best workers and the best companies
that will boost your career.
</p>
</div>
<div class="item6">
<h4>WHY WORK WITH US?</h4>
<p>
For our personal treatment, our advice, and above
all for our experience working in hotels in
numerous countries.
Because we know how difficult it is to take that step
of daring to work in a foreign country. Because we
know how hard it is to find the right staff.
</p>
</div>
<div class="item7">
<img src="http://localhost/wordpress/wp-content/themes/twentytwentyone-child/img/arvan4.jpg">
</div>
<div class="item8">
<h4>HOW WE WORK?</h4>
<p>
All candidates are interviewed by staff who have
worked in hotels, not offices
The same happens with our clients who have to
satisfy a series of criteria and guarantees for the
worker to work with us.</p>
</div>
<div class="item9">9</div>
<div class="item10">10</div>
</div>
<?php get_footer(); ?>
I want to fix .item4 and .item5 (they are in a row with 2 columns) and triplicate the row to be the same (with diff content) 3 times. And I want all of the 3 rows being fix.
The problem is when i put the position fixed in any of the .items the thing goes crazy.
I upload a image to clarify myself, sry about:
There u can see the 3 rows, I want the 3 rows being fixed, or at least the images being fixed for when I scroll down, the 2nd row will cover the 1st, and then the 3rd will cover the 2nd. I like this "diapositive" effect.
I tried some solutions, you can use this one:
when I position the element in the grid to fix, I make a new empty element with the same width and height, and the problem is solved.
I'm sure this question has been asked so many times its just not funny but having searched I can't find a solution that fixes my problem just right.
I have several fieldsets on a php page, the content of each one will be a block of text taken from a database. I want to align the text inside the fieldset both vertically and horizontally. The horizontal part is simple with text-align obviously but the vertical alignment is not so simple.
The resulting HTML markup:
<div class="s_container3">
<a href="custom.php?page=19">
<fieldset class="services_title2">
Some Short Text
</fieldset>
</a>
<a href="custom.php?page=18">
<fieldset class="services_title2">
More Short Text
</fieldset>
</a>
<a href="custom.php?page=20">
<fieldset class="services_title2">
Some long text that spills onto the second line
</fieldset>
</a>
<a href="custom.php?page=21">
<fieldset class="services_title2">
More short text again
</fieldset>
</a>
<span class="stretch"></span>
</div>
Below is a link to a jsfiddle I was playing with, it has all extra unrelated CSS stripped out to make sure I didn't have a conflict elsewhere.
jsfiddle example
You can see that the text just sticks to the top of the fieldset. I have tried putting an inner div container and everything else under the sun but I've been staring at this problem for so long it just isn't making sense to me anymore so I'm probably missing a simple solution.
Any help would be greatly appreciated, I'm open to any approach that'll move the text!
If anymore information is needed just ask!
Thanks in advance
You can set line height to your fieldset class, so:
html, body {
height:100%;
}
div {
margin-left:auto;
margin-right:auto;
margin-top:0px;
margin-bottom:0px;
}
div.s_container3 {
width:570px;
text-align:justify;
}
fieldset.services_title2 {
border:none;
font-size:1.3em;
width:215px;
min-height:45px;
vertical-align:middle;
text-align:center;
color:#ffffff;
background-color:#1c86b5;
margin-top:10px;
margin-left:auto;
margin-right:auto;
display:inline;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
-khtml-border-radius: 10px;
border-radius: 10px;
line-height: 45px;
}
.stretch {
width:100%;
display:inline-block;
font-size:0;
line-height:0;
}
a {
text-decoration:none;
}
http://jsfiddle.net/5H6Lf/
Please take a look at this site
Mess around with the browser window size for a little bit (I'm on Chrome and have not tried it with other browsers) and you will notice that my website takes up the entire page when the browser window is taking up only half of the monitor, but when the browser is in full screen mode, the content of the website stays to the left side of the webpage and the white margins get bigger. Also, my footer doesn't take up the entire page.
I don't want the site design to change, I just want all my site content to be shifted to the middle of the page when in full screen mode. I also want my footer rather then to be just sitting at the bottom of page only taking up part of it, extending across the entire page
HTML Code
<html !DOCTYPE>
<head>
<title>Mathew Crogan's Website</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div>
<form action="form.php" method="POST" id="form">
<br>
<br>
<br>Name:
<br>
<input name="contact_name" type="text">
<br>
<br>Email address:
<br>
<input type="text" name="contact_email">
<br>
<br>Message:
<br>
<textarea name="contact_text" rows="6" cols="30"></textarea>
<br>
<br>
<input type="Submit" value="Send">
</form>
<div style="height:60px; background-color:#000; color:#FFF; position:absolute; margin-left:0px; margin-top:200px;width:275px; text-align:center;">
<h3>Contact Me!</h3>
</div>
<div id="header">
<h1>Welcome To My Website!</h1>
</div>
<div id="firstlink"> <a id="firstlink" href="form.php">Main</a>
</div>
<div id="secondlink"> <a id="secondlink" href="me.php">Who I Am</a>
</div>
<div id="rollover"> <a id="rollover" href="project.php">Projects</a>
<a id="rollover" href="code.php">Code Used For These Pages</a>
</div>
<br>
<br>
<br>
<div id="condiv">
<p id="content">This is a website where I, Mathew Crogan, test out <i>HTML</i> or <i>PHP</i> or <i>CSS</i> Coding</p>
</div>
<div id="image">
<img id="me" src="img/1235154_462876267144148_1500701414_n.jpg">
</div>
<div id="footer">Web Designer: Mathew Crogan
<br>You are allowed to use this code. You can copy it from the "Code Used From These Pages" section. In order to use this code however, you must <b>GIVE CREDIT TO MATHEW CROGAN AND ASK FOR HIS PERMISSION USING THE "Contact Me" SECTION OF HIS MAIN PAGE</b>
</div>
</body>
</html>
Style.css:
html {
height:500px;
width:1000px;
;
}
#header {
height: 75px;
width: 600px;
margin-left:25px;
background-color: #DDDDDD;
text-align: center;
font-family: Tahoma, Geneva, sans-serif;
float:left;
}
#form {
float:left;
border: 1px solid #000000;
padding: 5px 5px 5px 5px;
margin-top: 200px;
}
#content {
color:red;
}
#condiv {
height:320px;
width:420px;
margin-left:315px;
margin-top:160px;
border: 1px solid #000;
border-radius:25px;
padding:10px 10px 10px 10px;
}
#image {
height:350px;
width:300px;
position:relative;
left:800px;
bottom:380px;
}
#me {
border:2px solid #000;
border-radius:25px;
}
#secondlink {
margin-left:190px;
}
a#rollover:link, a#rollover:visited {
display:block;
font-weight:bold;
color:#FFFFFF;
background-color:#B5B5B5;
width:120px;
text-align:center;
padding:4px;
text-decoration:none;
border:1px solid #000;
float:left;
margin-top:30px;
height:40px;
padding-top:8px;
}
a#rollover:hover, a#rollover:active {
background-color:#A7A7A7;
}
a#firstlink:link, a#firstlink:visited {
display:block;
font-weight:bold;
color:#FFFFFF;
background-color:#B5B5B5;
width:120px;
text-align:center;
height:44px;
padding-top:8px;
text-decoration:none;
border:1px solid #000;
position:absolute;
margin-top:105px;
margin-left:343px;
}
a#firstlink:hover, a#firstlink:active {
background-color:#A7A7A7;
}
a#secondlink:link, a#secondlink:visited {
display:block;
font-weight:bold;
color:#FFFFFF;
background-color:#B5B5B5;
width:120px;
text-align:center;
padding:4px;
text-decoration:none;
border:1px solid #000;
margin-top:30px;
float:left;
height:40px;
padding-top:8px;
}
a#secondlink:hover, a#secondlink:active {
background-color:#A7A7A7;
}
#footer {
display:block;
text-align:center;
border:1px solid #000;
background-color:#B5B5B5;
width:1000px;
position:absolute height:100px;
float:left;
padding:5px 20px 5px 20px;
margin-top:400px;
}
You can centre the whole body so you can have the space on both sides:
html {
height:500px;
width:1000px;
margin: 0 auto;
}
This is the most common method to center block elements in css, as explained in the link. However, I'd change it to something even more common:
html {
width: 100%:
}
body {
height:500px;
width:960px;
margin: 0 auto;
}
In this way, you can be assured that the html is the "base" for your meassures, and it's the full width of the page. Then you can work with the body. Also I set it a little smaller, to 960px, because one of the common resolutions is 1024px wide and with the scrollbars and other things it gets to just above that measure.
Lastly, the footer is a story apart that needs a huge article. And other people has already done it, it's called sticky footer, and google will provide enough information:
http://css-tricks.com/snippets/css/sticky-footer/
I have two DIV's that are side by side. One div is my side bar (Left Of Screen), the other div is my main content (Right Of Screen).
What I'm looking for:
What I want is one visable scroll bar to the far right of the screen. I would like that scrol bar to scroll both left and right div's.
My Problem:
Currently my left sidebar has a tree menu. When I expand my tree menu, I have no scroll bar to scroll down through the side bar content that was expanded. I'm able to add a scroll bar to my side bar, but that looks very ugly. I just want 1 scroll bar on the far right that handles both div's.
Can someone help me on this one?
My index.php file
<?php
include 'sidebar.php';
include 'main_body.php';
?>
My sidebar.php
<?php
echo '<link rel="stylesheet" href="css/style.css" type="text/css">';
echo '<script type="text/javascript" src="js/jquery1_3_2.js"></script>';
include 'function/functions.php';
// Establish a connection to our database
db_connect();
echo'
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(".content").hide();
//toggle the componenet with class msg_body
jQuery(".heading").click(function()
{
jQuery(this).next(".content").slideToggle(500);
});
});
</script>
';
echo'<div class="sidebar">';
// Side Bar Start
echo '
<img src="images/hdc_logo.png">
<br>
<br>
<p class="heading"><strong>CUSTOMER</strong></p>
<div class="content">';
//Display all customers from database
query_all_customers();
echo '</div>
<p class="heading"><strong>CABINET</strong></p>
<div class="content">';
// Display all cabinets from database
query_all_cabinets();
echo'</div>
</div>';
?>
My main content area
<?php
ini_set('display_errors', 1);
echo '<div class="main">';
echo'
<br>
<br>
Some data can go here
<br>
<br><br>
<br>
and here
<br>
<br>
and here
<br>
<br>
Some data can go here
<br>
<br><br>
<br>
and here
<br>
<br>
and here
<br>
<br>
Some data can go here
<br>
<br><br>
<br>
and here
<br>
<br>
and here
<br>
<br>
Some data can go here
<br>
<br><br>
<br>
and here
<br>
<br>
and here';
?>
My .css file
.sidebar {
width:200px;
position:fixed;
top:0px;
left:0px;
height:100%;
background-color:#54524F;
/*overflow-y: scroll;*/
}
.main {
width: auto;
margin-left: 200px;
}
.heading {
margin: 1px;
color: #fff;
padding: 3px 10px;
cursor: pointer;
position: relative;
background-color:#000000;
}
.content {
padding: 5px 10px;
}
#submit {
width:185px;
background-color: black;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius:6px;
color: #fff;
font-family:'Oswald';
font-size: 16px;
text-decoration: none;
cursor: pointer;
border:none;
}
#submit:hover {
border: none;
background:#FF9933;
box-shadow: 0px 0px 1px #777;
}
tr:nth-of-type(odd) {
background-color:#D4D4D4;
}
.container0 {
height: 100%;
width: 100%;
overflow-x: hidden;
position: relative;
padding-bottom: 30px;
background-color:black;
}
JSFiddle
in your css, set position of the sidebar to relative and set float to left, like this:
.sidebar {
width:200px;
position:relative;
top:0px;
left:0px;
height:100%;
background-color:#54524F;
float:left
}
the updated version of your jsfiddle to show you that it works :) http://jsfiddle.net/BrJDE/3/
because you dont want to have the scrollbar at the side of the page, i made some more examples for you. tell me if they are what you want, if its not, i would love to help you again.
both of these examples use 2 additional divs compared to the content you provided. these will make that you can position the scrollbar inside those div's instead of at the side of the browser. if you need me to explain the changes i made, just tell me.
scrollbar inside the page:
http://jsfiddle.net/BrJDE/6/
scrollbar inside the page at the left side of the scrolling div:
http://jsfiddle.net/BrJDE/5/
I am completely blocked on this problem, I am working with a CMS, and I am generating the articles, and I want them to be in two colums, so
here is the html code ( I deleted a bit of the php parts not to confuse you ):
<div id="contenu_col">
<?php
echo '<div class="col1">
<img src="square/'.$IMGACSQ.'" ><br/>
<p>'.aff($DATE).'<br/>'.aff($nom_projet).' - '.aff($ARTISTE).'</p></div>';
</div>
that generate an html code that look like that :
<div class="col1">
<a href="exhibition.php?ID=109">
<img src="square/E_3094_x.jpg" >
</a><br/>
<p>11.12. - 29.01.11.<br/>New impressions - New works - new artists - new space 5 and a happy new year)</p>
</div>
<div class="col1">
<a href="exhibition.php?ID=108">
<img src="square/BG_IoanGrosu06_x.jpg" >
</a><br/>
<p>30.10. - 04.12.10.<br/>Come here tomorrow - Ioan Grosu</p></div>
and the css :
.col1{
width:300px;
float:left;
padding: 3%;
display: block;
}
.col1 img{
width:100%;
}
.col1:after{
clear: both;
}
#contenu_col {
width:850px;
top:150px;
z-index:50;
left:460px;
position:absolute;
padding-bottom: 20px;
}
#contenu_col img{
width:100%;
}
( because I can't post images...)
It works 70% of the website; then sometimes some weird gap appears....
I don't understand what I'm doing wrong :(
RESOLVED.THANK YOU!!
Edit your col1 class and add a height,for example height:300px;
.col1 {
width: 300px;
float: left;
padding: 3%;
display: block;
height: 300px;
}
Also your DIV#encar isn't well styled.
it appears because .col1 height is not unified, try to add this to your css
.col1{
height: some value
}