Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
So this is what i have Tried, which doesn't work.
Ive also tried to make it a block and then margin that as 0 auto, like other questions say, but that doesn't help at all...
<!DOCTYPE html>
<html>
<head>
<style>
.logo {
text-align: center;
}
</style>
</head>
<header>
<div id="logo">
<img src="logo.png">
</div>
</header>
</html>
I just cannot seem to center this image, and i would like to in as little lines as possible.
need # for id . is used for class
#logo{
text-align:center;
}
Edit
Answered in comments above
I recommend you to add the body tag and do not make mistakes between id and class.
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
First off if someone can point me to a good reference that describes how css works and how to do basic stuff I would be very grateful! I know the stuff is out there but finding it with search engines is problematic because of the way results are weighted towards things that describe individual elements from a height of one inch (2.5 cm ;) but I need something looking from a height of a couple of metres!
here is some simple html:
<html>
<head>
<style type="text/css">.indent: { margin-left: 2em; margin-top: 0 } </style>
</head>
<body>
.indent { margin-left: 2em; margin-top: 0 }
Some text ...
<div class="indent">I want this indented:
xxxxx
</div>
</body>
</html><br>
which renders as:
Some text ...
I want this indented: xxxx
I want the last line indented and I can do this by specifying the style in the div tag. Further more I want to nest the divs and get another level of indenting.
EDIT: too late :)
So, as #ray hatfield said by removeing the ":" behind ".indent"
Tutorial
For Tutorials try W3Schools with a lot of information to HTML, CSS, JavaScript etc.: https://www.w3schools.com/w3css/default.asp
CODE
You can do it like this:
.indent { margin-left: 2em; margin-top: 0 }
<html>
<body>
Some text ...
<div class="indent">I want this indented:
xxxxx
</div>
</body>
</html><br>
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I'm sure this is really simple, sorry but I'm a web noob. I can't get the headings to show up on the page.
<html>
<style>
body {
background: linear-gradient(to right, #bdc3c7, #2c3e50);
}
<style/>
<body>
<h1>That Was Then<h1/>
<p> A toronto based band <p>
<body/>
<html/>
The syntax for an end tag is </type> not <type/>.
This would have been picked up if you had used a validator.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I know this is a rookie question, but why isn't my font colour changing?
My HTML:
<h1 class="InternetTitle">Internet Services</h1>
My CSS:
.InternetTitle {
color: 2777fd;
text-align: center;
}
It aligns my text vertically, but it doesn't change my color. And I can't figure out why.
I've also tried:
<h1>Internet Services</h1>
h1 {
color: 2777fd;
text-align: center;
}
You're missing the # - color: #2777fd.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
<html>
<head>
<style>
img.cardoption {width=20px;}
</style>
</head>
<body>
<img class='cardoption' src='http://s32.postimg.org/9vao2t9kl/scc_std.png'/>
</body>
</html>
In this simple piece of HTML, and accompanying CSS, I have an image with class name 'cardoption'. In the style tag in the head, I have attempted to set the width of this image to 20px.
However, for some reason the image is not resizing. Can someone please explain why?
Use
img.cardoption {width:20px;}
Replace = with :
(= is used for HTML attributes and : is used for CSS)
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
Okay, so this question could hardly be more basic, but... Why does this CSS rule not pick up the image inside the table?
# HTML
<table id="support-people"><tr><td>
<img src="http://news.bbcimg.co.uk/img/1_0_1/cream/hi/news/news-blocks.gif" /></td>
</tr></table>
# CSS
#support-people img {
width: 50px;
}
JSFiddle to show that the CSS is not being applied: http://jsfiddle.net/96F8H/
And if anyone can recommend me some kind of in-browser tool to pick up this kind of thing, bonus points...
It works fine. The problem was you had your CSS rule in the Javascript field. Here's a link with the things in the correct fields: http://jsfiddle.net/Skooljester/zHvx9/.
Your CSS is in the JavaScript box in your demo. Here's a corrected version.
If the example in the question is your actual code, you'll need to wrap the CSS with style tags:
<style type="text/css">
#support-people img { width: 50px; }
</style>
Mostly because you put the CSS in the Javascript part of JSFiddle.
Here's the working version with the CSS moved to the CSS section of the page: http://jsfiddle.net/96F8H/2/
It works fine. You put the css in the javascript section:
http://jsfiddle.net/96F8H/1/