Here is the jsfiddle link please do take a look
http://jsfiddle.net/o9rf3thy/
There seems to be a problem with the html.
CSS
.taro{
display: inline;
margin-left: 200px;
}
I am still learning CSS so please do be patient with me.
I am trying to obtain this result
https://www.dropbox.com/s/lq80rkc4w5fqpki/Screenshot%202014-11-21%2017.36.51.png?dl=0
Items that have display:inline either by default or by setting are not affected by margins.
What I think you require is display:inline-block
JSfiddle Demo
This might be useful LearnLayout.com
Hope this is what you want http://jsfiddle.net/89f5o3jL/2/
CSS
.list-group {
list-style-type: none;
margin: 0;
padding: 0;
}
.list-group-item {
overflow: auto;
padding-top: 15px;
}
.img-circle {
float: left;
margin-right: 20px;
border-radius: 30px;
}
.info {
float: left;
width: 500px;
border-bottom: #ccc 1px solid;
padding: 0 0 15px 0;
}
.label {
background: #5390fc;
color: #fff;
border-radius: 4px;
display: inline-block;
padding: 2px 7px;
margin: 10px 0;
}
HTML
<ul class="list-group">
<li class="list-group-item">
<img src="http://placepic.me/profiles/60-60" width="60" height="60" class="img-circle">
<div class="info">
<strong>
Crondeau Viner, MD
<span>Nov 5th , 2014</span>
</strong>
<br />
<span class="label">Note</span>
<p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum.</p>
</div>
</li>
</ul>
Your html contains several invalid tags:
you should use a self closing tag for img i.e. end it with /> instead of >
you should use <br /> instead of <br>
I would also consider changing the nesting of your tags so the spans don't contain br tags as it makes it easier to follow and style correctly.
Finally, if you want to make all the text display to the right of the image change display: inline to display: inline-block (jsfiddle)
<ul class="list-group">
<li class="list-group-item">
<img src="http://placepic.me/profiles/80-80" width="40" height="40" class="img-circle" />
<p class="taro">
<strong>
<b>Crondeau Viner, MD</b>
<label>
Nov 5th , 2014
</label>
</strong>
<br />Note
<br />
<span>hello Dr Jacqueline test - nov 5 </span>
<br />
</p>
</li>
</ul>
And your CSS would become
.taro{
display: inline-block;
margin-left: 200px;
}
Related
I can't seem to get links to center on my webpage. The code below should theoretically make the links appear in the center but it doesn't:
#navigate2 {
padding: 10px 20px;
background-color: #555555;
color: white;
text-decoration: none;
border-radius: 4px 4px 0 0;
text-align: center;
/*I have included text align but it doesn't seem to be working*/
}
#navigate2:hover {
background-color: #777777;
text-decoration: underline;
}
<div class="photo" >
<h3>Photo & Video</h3>
<!-- photo goes here -->
<br> <!-- I want the links labelled navigate 2 to be centered-->
<a id="navigate2" href="#">Browse my albums!</a>
<br> <br> <hr>
</div>
<div class="blog">
<h3>Blog</h3>
<br> <!-- read above -->
<a id="navigate2" href="#">Read my blog!</a>
<br> <br> <hr>
</div>
a tags are inline, so centering text in them has no effect. You could try to add display: block, or instead display: inline-block; and margin: 0 auto for centering the inline-block.
You need to have text-align:center property set to the parent of the anchor tags. Not to the anchor tags
#navigate2 {
padding: 10px 20px;
background-color: #555555;
color: white;
text-decoration: none;
border-radius: 4px 4px 0 0;
text-align: center;
/*I have included text align but it doesn't seem to be working*/
}
#navigate2:hover {
background-color: #777777;
text-decoration: underline;
}
.navigate-wrapper {
text-align: center;
}
<div class="photo">
<h3>Photo & Video</h3>
<!-- photo goes here -->
<br>
<!-- I want the links labelled navigate 2 to be centered-->
<div class='navigate-wrapper'>
<a id="navigate2" href="#">Browse my albums!</a>
</div>
<br>
<br>
<hr>
</div>
<div class="blog">
<h3>Blog</h3>
<br>
<!-- read above -->
<div class='navigate-wrapper'>
<a id="navigate2" href="#">Read my blog!</a>
</div>
<br>
<br>
<hr>
</div>
Firstly, id's should be unique, give your links a class instead. Secondly, a elements are inline, meaning you cannot apply a block level style to it. Instead, specify in your CSS to display it as a block: display:block;.
I've trying to do something that I'm sure is simple, but I can't do it.
All I want to do is have an image and then some text after that image, and be able to control accurately the amount of space between the image and the text.
Here's my code:
<div class="wrap"><div style="width:189px;""position:relative;float:left;top:5px;">
<img src="30000000_1.jpg" style="position:absolute" width="189">
</div>
In my style sheet, wrap has these attributes:
.wrap {
/*text-align: left;*/
width: 1100px;
height: 870px;
background-color: white;
color: black;
padding: 10px;
margin: auto;
}
I want my text to look like this directly below the image:
Username
Age
Location
Currently, I just add loads of break tags to control where I have the text, but that's messy and there must be a better way.
Thanks in advance for any help.
<div class="wrap">
<div style="width:189px;position:relative;float:left;top:5px;">
<img src="30000000_1.jpg" style="position:absolute" width="189" />
</div>
<br clear="all" />
<div id="bottomText">
Username
<br /><br />
Age
<br /><br />
Location
</div>
</div>
CSS:
.wrap {
/*text-align: left;*/
width: 1100px;
height: 870px;
background-color: white;
color: black;
padding: 10px;
margin: auto;
}
#bottomText{
margin-top: 10px;
}
Change margin-top: 10px to the desired distance.
Change bottomText to a class rather than an id, if you plan on having more than one.
(Note: I removed your "" from the second div because I'm not sure why that was there.
Check this solution jsfiddle. Personally I will not use inline style, because it becomes more messy. I have used <ul> for the text. This can give you better control over the position of the text.
Just use an Unordered List for the text since it is a list. ul are "block level elements" so they will self-clear. And definitely use an external stylesheet vs. inline styles. External is much cleaner and easier to work with and make changes to. Example: http://jsfiddle.net/codeview/Fk3EK/
HTML:
<div class="wrap">
<img src="30000000_1.jpg">
<ul>
<li>Username</li>
<li>Age</li>
<li>Location</li>
<ul>
</div>
CSS:
.wrap {
/*text-align: left;*/
width: 1100px;
height: 870px;
background-color: yellow;
color: black;
padding: 10px;
margin: auto;
}
ul { list-style-type:none; }
li { padding:5px 0; }
I can't get it to work. Probably because you guys can't see the other code I have going on. But maybe I was approaching the problem in the wrong way.
Here's my code before I started fiddling with css positioning:
<br><br>
<div class="imgleft">
</div>
<br><br><br><br><br><br><br><br><br><br><br>
<span style="font-weight: bolder;font-size: 12px;"></br><br><br></br>
<font color="green"> User69 </font> <img src="online01.gif" alt="" border="0" style="float:center"><br>
Location:
<script language="JavaScript" src="http://j.maxmind.com/app/geoip.js"></script>
<script language="JavaScript">document.write(geoip_region_name());</script></span>
</script></br>
<br><br>
The problem is, the images have a set width, but vary in height, so sometimes I'll use 8 break tags, other times 7, but the exact distance beneath each image (where the text goes) is different. And it looks bad.
There are 3 images on the page, so it goes image, text (well, there's an image as well, flashing gif) below image, then another image with text below it, and so on. From top to bottom on the left of the page.
Here are the relevant bits from my css:
.imgleft {
float: left;
width: 120px;
}
.imgleft img {
clear: both;
width: 175px;
padding-bottom: 0px;
}
I'm certain I'm making this way more complicated than it needs to be! Sorry.
I've put a link to my code in the comments to the first answer, if someone could take a look. Thanks.
I'm trying to move a table row containing navigation links for my website from being left aligned to being right aligned, but no matter what I edit nothing moves. I've only recently started learning HTML and CSS so any help would be appreciated.
HTML
<div id="nav">
<table>
<tr>
<td>
<a href="index.html">
<img src="Images/Home.png"/>
</a>
</td>
<td>
<a href="Learn.html">
<img src="Images/Learn.png"/>
</a>
</td>
<td>
<a href="Practice.html">
<img src="Images/Practice.png"/>
</a>
</td>
<td>
<a href="About.html">
<img src="Images/About.png"/>
</a>
</td>
<td align="right">
Donate
</td>
</tr>
</table>
</div>
CSS
#nav {
width: 100%;
height: 10%;
float: right;
background-color: #47B531;
margin: 0px;
padding:0px;
white-space: nowrap;
}
#nav tr {
margin: 0px;
padding: 0px;
width: 100%;
}
#nav td {
font-size: 18px;
margin: 0px;
padding: 5px;
text-align: right;
margin: 0px;
}
#nav img {
width: 30px;
height: 30px;
display: inline;
padding: 5px;
margin: 0px;
}
Please use
<table align="right">
instead of just table tag.
Usually, the navigation menues are designed using lists instead of tables. Here a very very simple example:
HTML:
<div id="nav">
<ul>
<li>
<img src="Images/Home.png"/>
</li>
<li>
<img src="Images/About.png"/>
</li>
<li>
<img src="Images/Contact.png"/>
</li>
<li>
Donate
</li>
</ul>
</div>
CSS:
#nav ul {
list-style: none;
}
#nav ul li{
float:right;
margin-left: 10px;
}
The options using this method is endless, give it a try and let us know if you got stuck or have questions about it.
Heres the Fiddle: http://jsfiddle.net/Q5Vh3/
If you mean that you want the links on the right, within the div element, without changing the table cell rendering from the current one, just add the rule
#nav table { float: right; }
Use #Dave's suggestion next time. Lists are much more efficient and easier. But to answer your question you can use align=right on the table to fix it.
Look at this fiddle http://jsfiddle.net/uhLuh/
Awareness of current web standards is crucial. I recommend diving head into HTML 5 & CSS3.
I believe that you should be looking to follow HTML 5 standards with CSS3.
Here is how to ideally approach a HTML5 navigation element and the base CSS3 elements and attributes that should get you pointed in the right direction :)
HTML5
<nav>
<img src="Images/Home.png"/>
<img src="Images/Home.png"/>
<img src="Images/Home.png"/>
<img src="Images/Home.png"/>
</nav>
CSS3
ul { }
nav ul
{float: right; *Adjust to suit
text-align:right; *Adjust to suit
list-style: none;} *Adjust to suit
nav ul li { }
nav ul a { }
Hope this helps you!
I have a margin used to space some headings down away from an image, but despite this method working on other pages, it does not in this instance.
I know there are plenty of alternative solutions, but am curious as to what is wrong with this one. Can anyone help?
<div class="column" style="width: 237px">
<img src="img.jpg" alt="" title="img" width="237" height="300" class="alignnone size-full wp-image-84" />
<h1 style="margin-top: 40px">VAL</h1>
<span class="detailhead">Heading 1</span> <span class="detail">Detail 1</span><br />
<span class="detailhead">Heading 2</span> <span class="detail">Detail 2</span>
</div>
These are all the additional class declarations:
The image class has no associated style (class was inserted by Wordpress).
h1 {
font-size: 17px;
}
span.detailhead{
font-size: 13px;
color:#000000;
}
span.detail {
position: relative;
top: 1.5px;
font-size: 14px;
color:#000000;
}
.column {
display: block;
float: left;
}
Here is the offending style i overlooked:
img {
display: block;
float:left;
margin-right:10px;
margin-bottom:10px;
border-style: solid;
border-width: 1px;
border-color: #ffffff;
z-index: 2;
}
A more specific selector fixed the issue.
Thanks to all for helping me with this seriously schoolboy error!
Could you try adding a style="display:block" to the img tag?
If your using chrome or safari for testing: use the element inspector to check wether your inline setting is not overruled by an !important; declaration in one of the classes.
Edit: To quickly test this you can also add " !important;" to your inline css.
I have a strange bug when looking at my homepage in Chrome. The bug doesn't seem to appear when I try to edit it with CSSEdit:
I attached the pictures to show you what I mean. Those "points" next to the icons are linked as well.
What could be causing this error?
Thanks for the help!
EDIT sure here's the code (the page isn't online):
<div class="rss">
<p>
<a href="http://linkto">
<img src="/images/facebook.png" alt="Find me on facebook" />
</a>
<a href="http://linkto">
<img src="/images/twitter.png" alt="Follow me on twitter" />
</a>
<a href="http://linkto">
<img src="/images/rss.png" alt="Subscribe to RSS Feed" />
</a>
</p>
</div>
which is wrapped in a div class called footer. And the CSS
.site .footer {
font-size: 80%;
color: #666;
border-top: 4px solid #eee;
margin-top: 2em;
overflow: hidden;
}
.site .footer .rss {
margin-top: 0em;
margin-right: -.2em;
float: right;
}
.site .footer .rss img {
border: 0;
}
Sorry for the strange formatting.
Those "points" are the text-decoration:underline portion of your CSS being applied to <a> tags. The reason you only see part of it is because the image you are using is covering the majority of it.
Try putting this in your CSS:
.rss a { text-decoration:none }
.rss a img { border:none; outline:none }