Is it possible to position a link or text dynamically based on the content present above.
For example, I have a page as follows:
Dashboard.xhtml
<div id="innerContainer">
<p:dataTable id = "adminDataTbl" value="#{userAdminMB.userRoles}" var="userList" selectionMode="single" selection="#{userAdminMB.selectedUser}" rowKey="#{userList.ntId}" styleClasses="order-table,table" headerClass="order-table-header" rowClasses="order-table-odd-row,order-table-even-row" >
<p:column styleClass="table-data">
#{userList.ntId}
</p:column>
<p:column styleClass="table-data">
#{userList.roleList}
</p:column>
</p:dataTable>
</div>
<div id="userLink">
<h:commandLink action="#{userAdminMB.addUser}">
<h:outputText value="Add a User to the Admin Tool"/>
</h:commandLink>
</div>
styles.css
#outerContainer{
width: 100%;
height: 500px;
top: 150px;
border: 1px thin;
}
#innerContainer{
width:100%;
height:400px;
text-align: right;
margin-right: 9px;
font-family: Arial;
font-size: 16px;
border: 1px thin;
}
#addUserLink{
font-family: Arial;
font-size: 16px;
float: left;
top: 550px;
position: inherit;
}
.editUserLink-data{
font-family: Arial;
font-size: 16px;
float: right;
top: 175px;
}
The data in <p:dataTable> may be different based on the DB hit that is made. I need the addUser link to be positioned accordingly.
Please help. Any help will be much appreciated.
If I am understanding you correctly then what you want to do is:
<div sytle="textalign: right" id="firstLink">Link1</div>
<div id="dynamicContent">
dynamic content here
</div>
<div id="link2">Link2</div>
If you want to add relative positioning between the dynamicContent and link2 divs you can do so.
Using the above code the link two will fall below the dynamic content on your page
Related
I am in need of moving a set of tables up in my current document.
I have tried adjusting the margins in the CSS but cannot seem to get it right.
This is what I have:
This is what I am trying to achieve:
The max-width must be 700 px. I have it all set up, apart from the positioning of the tables (images) needing to be moved up onto the background image.
#charset "UTF-8";
/* CSS Document */
body {
margin-top:0;
padding-top:0;
background:#fff;
/*JTL ADDED - Limit container max width within BB Content Area*/
max-width:700px;
text-align:left;
margin-left:auto;
margin-right:auto;
/*End JTL */}
.background-pic {
background-image: url("Image Background.png");
height: 450px;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
margin-bottom: -100px;
max-width: 700px;
}
h1{
padding-top: 50px;
text-align: center;
font-family: "bebas-neue";
font-weight: normal;
font-size: 50px;
color: #fff;
}
.col-welcome-1 {
float:left;
margin-left: 25px;}
.col-navmenu-1 {
float:right;
width: 250;
height: 255;
margin-right: 25px;
border-radius: 10px;
background: #252525;}
h2 {
color: #FFFFFF;
text-align: center;
font-weight: 200;
font-size: 24px;
font-family: Gotham, "Helvetica Neue", Arial, "sans-serif";
}
.navbuttons {
padding-left: 45px;
}
#footer {clear:both;text-align:left;padding:0 12px 2px 12px;background:#eee;
border-top:1px solid #502e74}
.redline {
border-bottom-style: solid;
border-bottom-color: #502e74;
border-bottom-width: 1px;
}
table { border-spacing: 0px; } /*JTL Added whole section*/
th, td { /*JTL Added whole section*/
padding-left: 5px;
padding-right: 5px;
padding-top: 0px;
padding-bottom: 0px;
} /*JTL Added whole section*/
a:link {color:#502e74}
a:visited {color:#036}
a:active {color:#502e74}
a:hover {color:#000;background:#ffc;text-decoration:none}
/* When the screen is less than 600 pixels wide, hide all links, except for the first one ("Home"). Show the link that contains should open and close the topnav (.icon) */
#media screen and (max-width: 600px) {
.topnav a:not(:first-child) {display: none;}
.topnav a.icon {
float: right;
display: block;
}
}
/* The "responsive" class is added to the topnav with JavaScript when the user clicks on the icon. This class makes the topnav look good on small screens (display the links vertically instead of horizontally) */
#media screen and (max-width: 600px) {
.topnav.responsive {position: relative;}
.topnav.responsive a.icon {
position: absolute;
right: 0;
top: 0;
}
.topnav.responsive a {
float: none;
display: block;
text-align: left;
}
}
<!DOCTYPE html PUBLIC>
<html lang="en">
<link href="Professional Development Getting Started Template Style.css" rel="stylesheet" type="text/css">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="stylesheet" href="https://use.typekit.net/mlt2oco.css">
<title>Professional Development Overview Template</title>
</head>
<body>
<div class="main-content">
<div id= "banner">
<div class="background-pic">
<h1>Professional Development<br>Overview</h1></div>
<table style="margin-left:auto; margin-right: auto; padding-bottom: 25px;">
<tbody>
<tr>
<td><div class="col-welcome-1"><img src="Welcome Video.png" alt="welcome video" class="rounded" width="320" height="255">
</div></td>
<td>
<div class="col-navmenu-1">
<blockquote>
<h2>NAVIGATION</h2>
</blockquote>
<div class= "navbuttons">
<img src="How to Navigate button.png" alt="How to Navigate Training " class="rounded" width="175" height="45">
<img src="track my progres button.png" alt="Track My Progress" class="rounded" width="175" height="45">
<img src="faq button.png" alt="How to Navigate Training " class="rounded" width="175" height="45">
<img src="access modules button.png" alt="How to Navigate Training " class="rounded" width="175" height="45">
</div>
</div>
</td>
</tr>
</tbody></table>
</div>
</div>
<div class="resource-content">
<table style="margin-left:auto; margin-right: auto;">
<tbody>
<tr>
<td>
<div class="col-resource-1"> <img src="FightforFreedom.png" alt="Salvation Army Justice Action Plan" class="rounded" width="165" height="97"></div></td>
<td><div class="col-resource-2"><img src="TNU Graduate Programs.png" alt="Link to Trevecca Gradate Programs" class="rounded" width="165" height="97"></div></td>
<td><div class="col-resource-2"> <img src="Trevecca's Master's in Organizational Leadership Program.png" alt="Trevecca's Organizational Leadership program" class="rounded" width="165" height="97"></div></td>
</tr>
</tbody></table></div>
<div id="footer">
<p class="xsmall"><strong>Trevecca Nazarene University</strong></p>
<p class="xsmall">Helpdesk Support Contact:Online Course Technical Support Site</p>
</div>
</body>
</html>
what I see is that your table content is outside your div class="main-content". I would suggest you to
put the table content inside class="main-content" by removing a closing div after h1 tag Professional DevelopmentOverview
delete closing div before class="resource-content".
rename css .background-pic to .main-content - that styling will make more sense.
But overall I think you have trouble with proper divs - thats causing a lit of trouble in your site and headache in styling process.
One option if you want your table overtop of other content is to change the position to absolute and adjust the top/right/bottom/left as you wish. For example:
.col-navmenu-1 {
position: absolute;
bottom: 20px;
left: 500px;
float:right;
width: 250;
height: 255;
margin-right: 25px;
border-radius: 10px;
background: #252525;}
Keep in mind you will have to adjust your media queries.
The following HTML code:
<div class="main-container">
<div id="top-section-main">
<div id="top-section-content">
<h1>Awesome looks so good</h1>
<p>Awesome is the landing page you wish you had when you started</p>
<p class="playBTN"><img src="Images/9.1 Play.png" height="120px" width="120px"></p>
<div class="main-form">
<form>
<h6>SIGN UP FOR A FREE 30 DAY TRIAL</h6>
<input type="text" name="name" placeholder="Name">
<input type="email" name="email" placeholder="Email">
<button style="trial" type="submit" value="submit">Start Free Trial</button>
</form>
</div>
</div>
</div>
</div>
And it's corresponding CSS:
#top-section-main{
background-image: url(/Images/6.1\ Friends.jpg);
height: 740px;
border: none;
}
#top-section-content{
width: 60%;
margin-left: auto;
margin-right: auto;
margin-top: 0;
}
#top-section-content h1{
font-size: 4em;
font-weight: 300;
color: #ffffff;
text-align: center;
margin: 0;
padding-top: 100px;
}
#top-section-content p{
font-size: 1.3em;
font-weight: 400;
color: #ffffff;
text-align: center;
margin-top: 10px;
}
.playBTN{
text-align: center;
margin: auto;
padding: 50px 0 100px 0;
}
.main-form h6{
font-family: sans-serif;
font-size: 0.9em;
font-weight: 100;
color: #ffffff;
text-align: center;
}
.main-form input{
width: 30%;
margin: 0;
height: 40px;
font-family: sans-serif;
font-size: 15px;
padding-left: 15px;
font-weight: 100;
border: none;
}
.main-form button{
width: 30%;
height: 42px;
font-family: sans-serif;
font-size: 15px;
padding-left: 15px;
font-weight: 100;
background-color: #6dc77a;
color: #ffffff;
border: none;
}
This is a problem regarding a static webpage that I created. When this is launched via the IDE itself (VScode), there is no issue and every image is being displayed. But when I open the html file separately from the folder, few images are missing. I've checked the path of the pictures and it looks good (note - all the images are present within the folder) . Any idea on what may have gone wrong?
few images are missing
Which ones are displayed and which ones are missing? Please be more specific when reporting a bug.
Where's your stylesheet relative to your HTML page? No <link> in your code so wWe don't have that information.
(I don't know how VSCode differs from a regular browser) Assuming the img element in your HTML code is displayed, your background-image should looks like background-image: url("/Images/6.1 Friends.jpg");. Try removing the trailing slash if it still doesn't display.
If your stylesheet isn't in the same directory than your markup, then you still may have a problem: that trailing slash s the root of your files which is a known location with a webserver (protocol http(s):// in your browser) but is the root of the filesystem of your OS with file:/// protocol.
More general note: when relative, path of CSS ressources is relative to the location of that CSS, not relative to your HTML page.
OT: alt attribute is mandatory for <img> elements. It should be alt="" for decorative images and alt="something meaningful" for images bringing information (see WAI tutorial for more information)
Ok, I'm working on this website (its my first one), and I am looking for some insight on making my nav menu work better. When you go to the "projects" page, the about button all of a sudden looks like it has too much spacing to the right. Also, when you go to the "Contact" page, the menu is totally messed up. I thought about just adding the home button to the main page navigation so all the menus would be exactly the same and maybe it would work right, but there HAS to be a better solution.
Also, the website looks really flat. I'd be open to suggestions on giving it some depth, as well as any other criticism you may have. (bear in mind I've only been doing this for a couple months).
Web address
HTML:
<ul class="transparent" id="navcontainer" >
<li class="topnavleft floatleft">Home</li>
<li class="topnav floatleft">About</li>
<li class="topnavright floatleft">Projects</li>
</ul>
CSS:
#navcontainer {
margin-top: 0;
height: 55px;
width: 232px;
float: right;
overflow: visible;
padding: 0;
}
.topnav {
width: 45px;
border-right: 1px solid #FFF;
margin-right: 10px;
padding-right: 22px;
margin-left: 10px;
margin-top: 16px;
}
.topnavleft {
width: 45px;
border-right: 1px solid #FFF;
border-left: 1px solid #FFF;
margin-left: 7px;
padding-left: 10px;
padding-right: 6px;
margin-top: 16px;
}
.topnavright {
width: 45px;
border-right: 1px solid #FFF;
margin-right: 7px;
padding-right: 20px;
padding-left: 1px;
margin-top: 16px;
}
There is a problem with this line in the About page:
<div class="transparent" id="logo"><img src="Images/ALR%20%20custom%20guitars2.png" alt="ALR Custom Guitars" width="250" border="0" </img>
You have missed out the closing /> of the img tag, it should be like this:
<div class="transparent" id="logo"><img src="Images/ALR%20%20custom%20guitars2.png" alt="ALR Custom Guitars" width="250" border="0" /></img>
For screenreaders and search engines, the logo should have the text ALR Custom Guitars, use a background-image instead of an img tag, and set text-indent: -999px so that only the image will show.
Also, lots of your links point to www.ALRGuitars.com, they should be http://www.ALRGuitars.com.
EDIT:
Here are some errors to correct (remember to correct all errors and warnings from the W3C validation result):
This:
<a href="http://www.facebook.com/pages/ALR-Guitars/301363959926689" target="_blank"><img src="Images/facebook_512.png" border="0" height="32px" width="32px" </img><a/>
<img src="Images/twitter_512.png" border="0" height="32px" width="32px"</img>
Should be:
<a href="http://www.facebook.com/pages/ALR-Guitars/301363959926689" target="_blank"><img src="Images/facebook_512.png" border="0" height="32px" width="32px" />
<img src="Images/twitter_512.png" border="0" height="32px" width="32px"</img>
In the copyright notice, you have forgotten a semicolon after a character reference.
Either use © or ©.
This:
<link href'http://fonts.googleapis.com/css?family=Over+the+Rainbow|Open+Sans:600,700italic' rel='stylesheet' type='text/css'/>
Should be:
<link href='http://fonts.googleapis.com/css?family=Over+the+Rainbow|Open+Sans:600,700italic' rel='stylesheet' type='text/css'/>
There was a missing = sign after href.
EDIT #2:
After some fiddling with the CSS, try this for the menu:
#navcontainer {
float: right;
width: 250px;
height: 30px;
padding: 5px;
margin-top: 0;
overflow: visible;
}
.topnav a {
display: block;
width: 70px;
height: 20px;
padding: 5px;
text-align: center;
}
a:hover {
color: #606060;
font-style: italic;
}
It should correct the problem of the links moving when hovered over.
the spacing is because you specified topnav width as 45...'projects' is too large and 'about' is too small..let it be automatic or try to align all the text into the middle so that it wont seem weird...
I've created a simple get method form and am having trouble centering the input box. The code works fine out of wordpress, but when I insert into a wordpress page, the input box becomes mis-aligned.
Here's the code I'm inserting on the wordpress page.
<div class="homebox">
<form method="get" action="/home-quote-page.html" form name="quote" rel="nofollow" onsubmit="return ray.ajax()">
<p class="topquotetext">Enter your zip code:</p>
<p><input name="zipcode" class="zipbox" type="text" value="" size="5" maxlength="5"/> </p>
<p><div style="getquote"><input type="image" src="/Photos/startquote.gif" alt="Start Your Quote" name="go" value='Submit'/></div></form></p>
<div id="load" style="display:none;">Finding...Please wait.</div>
</div>
Here's the css. Everything works fine except .zipbox it will allow me to change the color of the box and the height but that's it. No matter what number I input into the width of the box it stays the same width, it also doesn't center inside the div.
.homebox {
text-align: center;
width: 300px;
height: 268px;
background: #2872bd url(/Photos/home-insurance-box.jpg) no- repeat; }
.topquotetext {
font-family: sans-serif, Arial, Verdana;
font-size:16px;
color:#ffffff;
padding-top:70px;
text-align: center;
}
.zipbox {
width: 95px;
height: 25px;
text-align: center;
font-size: 24px;
margin-right: 10px;
margin-left: 10px;
margin-top: 5px;
border: #7F9DB9 1px solid;
background-color: #FFFED2;
}
.getquote {
width: 300px;
text-align: center;
}
Are you pasting this into the default WYSIWYG in WP? If so, WP is stripping out some of your markup. Find a plugin that will allow you to paste in markup, or create a new template and hard-code this section.
Of course it would be centered if you use margin-left: 10px; on the .zipbox and text-align: center would not make element centerd, just text which will be centered. There's nothing wrong with WordPress, it's just how you style the element.
Try this, a bit change of your stylesheet.
.zipbox {
width: 95px;
height: 25px;
display: block;
overflow: hidden;
clear: both;
margin-top: 5px;
margin-left: auto;
margin-right: auto;
font-size: 24px;
border: #7F9DB9 1px solid;
background-color: #FFFED2;
}
And also make sure that the parent element style not affecting the .zipbox and you don't need to wrap the <input /> element in <p></p>, wrap it with <div></div> instead.
I'm new to web design, so please forgive if this is super simple- I've tried everything I know and can't quite seem to get this right.
I've put together a contact form using html & css. Ideally, I'd like to have a 1px line extending from each label to use as an input guide. This line should be level with the bottom of the label. I'd also like a series of lines extending vertically in the text area to allow for extra writing space.
Currently, the input lines for Name and Email aren't showing, and there is only one line at the very bottom of the textarea for Message.
Here's the code I'm working with:
<div id="contact-form">
<div id="invite">
<h1>Let's Talk.</h1>
<div class="postinfo">
<h2>Have you got a project needing an eye for detail and a creative touch? I'd love to hear from you.</h2>
</div><!-- end postinfo -->
</div><!-- end invite -->
<form>
<label for="user">Name:</label>
<input type="text" name="user" value="" /><br />
<label for="emailaddress">Email:</label>
<input type="text" name="emailaddress" value="" /><br />
<label for="comments">Message:</label>
<textarea name="comments"></textarea><br />
<input type="submit" name="submitbutton" id="submitbutton" value="Submit" />
</form>
</div><!-- end contact -->
#contact-form {
float: left;
margin-left: 300px;
margin-top: 310px;
}
#invite .postinfo {
list-style-type: none;
width: 150px;
}
label {
float: left;
font-family: dalle;
font-size: 160%;
letter-spacing: 2px;
text-transform: uppercase;
margin-left: 200px;
margin-top: -105px;
width: 120px;
}
input, textarea {
border-style: none;
border-bottom: 1px solid #202020;
margin-bottom: 5px;
margin-left: 300px;
margin-top: -105px;
width: 245px;
}
textarea {
width: 250px;
height: 150px;
}
#submitbutton {
background: none;
border-style: none;
font-family: Georgia,
Constantia,
"Lucida Bright",
"Bitstream Vera Serif",
"Liberation Serif",
serif;
margin-left: 173px;
margin-top: 5px;
width: 90px;
}
br {
clear: left;
}
Ideal outcome:
Based on your code i create a fiddle see below. If any changes or other requirement please clarify.
Fiddle: http://jsfiddle.net/EaKmZ/
Demo: http://jsfiddle.net/EaKmZ/embedded/result/
Note: I have not edited your code too much so many un necessary css are present and not required.
There were some unneeded CSS rules on your codes. Try this demo to see it fixed to some extent but lines on text area cannot be achieved using CSS.
You need to use image for that. See a demo